JAVA DEVELOPMENT KIT
java development kit is the software kit provided by Javasoft that provides classes , packages , methods , etc. for developing Java applications.
JAVA RUN-TIME ENVIRONMENT
Each and every program written in any programming languages requires an environment to get executed. The environment provided by Java is JRE(java run-time environment). That consist of mainly the class loader and the java virtual machine.
CLASS LOADER :
- while execution all the classes i.e pre-defined and the user defined classes both are loaded by it.
JAVA VIRTUAL MACHINE :
All the language compiler translates source code into machine code for a specific computer. JAVA also does the same thing. JAVA compiler i.e JAVAc produces an intermediate code known as bytecode for machine that does not exist.This machine is called as JVM and it exist only inside the computer memory.It is a simulated computer within the computer and does all the work of real computer.
process of compilation
The virtual machine code is not machine specific.The machine specific code 9machine code) is generated by the Java interpreter by acting as a intermediatery between the virtual machine and the real machine.
note : interpreter is different for different computers
BYTECODE:
It is a set of a highly optimized set of instruction designed to be executed by the java run time system,which is called the java virtual machine.
JAVA PROGRAMS
Java programs are a collection of whitespace , identifiers, literals , comments, operators, seperators and keywords.
whitespace :
In java , whitespace is a space, tab or newline.
identifiers :
Identifiers are used for class name , method name and variables name. An identifier can be any descriptive sequence of uppercase and lowercase letters, numbers or the underscore and dollar sign characters. They must note begin with a number, lest they will be confused with a numeric literals.
NOTE : Java is a case sensitive, so in java "BIPLOV is different identifier than biplov."
literals :
A constant value in java is created by using a literal representation of it.
example : 100 is a integer
98.6 is a floating-point value.
"X" is a variable.
"biplov pradhan" is a string.
comments :
three types of comments are used in java.
- single line : only one single statement is given as a comment with the help of "//" symbols.
example : // input of the person is taken.
-multiline : more than ine statements are given as a comment with the help of "/* " " */ " symbols.
example : /* thanx for visiting my blog. hope you will like it - biplov pradhan */
-documentation comment : this type of comment are used for HTML file that documents your program. The documentation comment begins with a "/** " and ends with a " */ ".
seperators :
In java there are few charaters used as seperators.here are the list of few
java keywords
Keywords are explicitly reserved identifiers and cannot be used as names for the program variable or other user defined program elements.
There are 50 keywords currently defined in java language.These keywords combined with the syntax of the operators and seperators, form the foundation of the java language.The keyword const and goto are reserved as keywords but they are not used. In early days of java ,several other keywords were reserved for future possible use.
In addition to these keywords , Java reserves the following :"true ,false and null " .These are the values defined by java.We cannot use them as names for program varriables , classes anf so on.
THE JAVA CLASS LIBRARIES
The java environment relies on several built-in class classes that consist of many built-in methods that provide support for such things as I\o , String handling, networking and graphics.
A SIMPLE JAVA PROGRAM
//simple java program Example.java
import java.io.*;
class Example
{
public static void main( String arg[])
{
int num;
num = 100 ;
System.out.println("This is num : " + num );
num = num * 2;
System.out.print("the value of num*2 is " );
System.out.println(num);
}
}
OUTPUT :
This is num : 100
The value of num*2 is 200
EXPANATION :
in this program we are simply taking a variable num, in which we are assigning a value i.e. 100. now , num is multiplied by 2 to give the desiered output.
Here there are few terms like System , String should begin with uppercase alphabet as java is case sensitive and these are java built in classes.
"public" is the access specifier
static " is the non access specifier
"void" is the return type.
No comments:
Post a Comment