javabymanish

Search results

Wednesday, 23 October 2013

Chapter - 4 (JDK, JVM and JRE)

Before starting the introduction to JDK, JRE and JVM..........We discuss that which types of programming did in java.
So, using java we do three types of programming in java........

1 - Desktop Application   : Desktop application is a program that runs on your computer, under the         operating system of the computer. You can also create Graphical User Interface (GUI) applications. These application is used in the windows environment. This application do not need any kind of server for the execution.

2 - Web Application : Web application is a program that runs on server means that for the execution of web application you must need a server such as Weblogic, apache tomcat,glassfish. etc.

3 -  Mobile Application : Mobile application is a program that is used in mobile phones and also in embedded programming.  

 Types Of Java :

 1 - J2SE (Java 2 Standard Edition) or Core Java - used for desktop application.
 2 - J2EE (Java 2 Enterprise Edition) or Advanced Java -  used for web application.
 3 - J2ME(Java 2 Micro Edition) or Mobile Application - used for mobile application.

Now we are going to discuss the core things in java i.e. JDK, JRE and JVM.............

JDK : JDK stands for Java Development Kit. JDK provides the tools to integrate and execute applets and applications. JDK consists mainly of the core API classes, a java compiler and java virtual machine
interpreter.

JVM : JVM stands for Java Virtual Machine. JVM is used for interpreting java program. JVM is not platform independent.

JRE : JRE stands for Java Runtime Environment. JRE provides an environment for the execution of java applications. Following figure shows the working of JRE :



           



Access Specifier :

                             Access specifier, specify the scope of variables, methods and class. In Java there are four types of access specifier :-

1 - public : Access inside and outside of the package.
2 - default : Access within package only not outside.
3 - protected : Variables, methods and constructors which are declared protected in a superclass can be accessed only by the subclasses in other package or any class within the package of the protected members' class. Protected can't applied on class and interface.
4 - private : Access within block where it can be defined.


                                         
                                                               

Java Program Compilation Environment:

                                             

                                                                           
 

 Path Setting : For the execution of java program we can set the path. There are following step for set the path :

  • Right click on computer
  • Click on manage
  • Advanced Setting
  • Environment Variables
  • In user variable click on new
  • type path inside variable name
  • type path till bin i.e in my case (C:\Program Files\Java\jdk1.6.0\bin) after this use semicolon
  • then ok   
   Operators : Operator that operate on operands. There many types of operator. Some of them are follows:
  • Arithmetic Operator - Used for arithmetic operation (+, - , /, *, %)
  • Comparison Operator - Used for decision making statements (<, >, <=, >=, !=, ==)
  • Assignment Operator - Used for assign the values (+=, -=, /=, *=, %=)
  • Logical Operator - Also used for decision making statements (&&, ||, !)
  • Unary Operator - Used on single variable. There are two types of unary operator as following :                                                             
                Increment/Decrement Operator :

                                                         

  • new operator : Used for creating object. There are two ways to create an object, as follows : 
                               a) <class-name> <variable-name> = new <class-name>();
                                 Ex.:         Abc a = new Abc();

                              b) <class-name> <variable-name>;
                                  <variable-name> = new <class-name>();
                                Ex.:            Abc a;
                                                   a = new Abc();

                            Where a is called Reference variable.

Java Keywords : Keywords are words reserved for java and can't be used as identifiers or variables names. There are following keywords in java as follows :

                                                                     


Compiling and Executing Java Programs :

                         For compiling java program use the following syntax :
                                              javac <class-name>.java 
                                      Ex. : javac Abc.java

                         For executing the java program use the following syntax :
                                               java <class-name>
                                         Ex. : java Abc

                  

                                                     
                     
                                


                                  
                                                           

No comments:

Post a Comment