Professional Documents
Culture Documents
Java History
Polymorphism
Inheritance
Encapsulation
Abstraction
Classes
Objects
Instance
Method
Message Parsing
Java Versions History
Bytecode Verifier: checks the code fragments for illegal code that can violate
access right to objects.
JVMs are available for many hardware and software platforms. JVM, JRE and
JDK are platform dependent because configuration of each OS differs. But, Java is
platform independent.
Each thread has a private JVM stack, created at the same time as thread.
A new frame is created each time a method is invoked. A frame is destroyed when
its method invocation completes.
It contains:
1) A virtual processor
Name Convention
package name should be in lowercase letter e.g. java, lang, sql, util etc.
Local Variables
Class Variables (Static Variables)
Instance Variables (Non-static variables)
Java Keywords
1.byte:
Byte data type is an 8-bit signed two's complement
integer.
Minimum value is -128 (-2^7)
Maximum value is 127 (inclusive)(2^7 -1)
Default value is 0
Byte data type is used to save space in large arrays,
mainly in place of integers, since a byte is four times
smaller than an int.
Example: byte a = 100 , byte b = -50
2. short
1. Arithmetic Operators
2. Relational Operators
3. Bitwise Operators
4. Logical Operators
5. Assignment Operators
6. Increment & Decrement Operators
7. instanceOF & dot Operator
instanceOf Operator
class Simple1{
public static void main(String args[]){
Simple1 s=new Simple1();
System.out.println(s instanceof Simple1);//true
}
}
Output :
true
Mathematical Functions in Java
Syntax:
The syntax of enhanced for loop is:
for(declaration : expression) { //Statements }
Declaration: The newly declared block variable, which
is of a type compatible with the elements of the array
you are accessing. The variable will be available within
the for block and its value would be the same as the
current array element.
Expression: This evaluates to the array you need to
loop through. The expression can be an array variable or
method call that returns an array
Example Enhanced for loop
for(int x : numbers ){
System.out.print( x );
System.out.print(",");
}
System.out.print("\n");
String [] names ={"James", "Larry", "Tom", "Lacy"};
for( String name : names ) {
System.out.print( name );
System.out.print(",");
}
}
}
Output
10,20,30,40,50,
James,Larry,Tom,Lacy,
Decision Making
tatement Description
An if statement consists of a boolean
if statement expression followed by one or more
statements.
An if statement can be followed by an
optional else statement, which
if...else statement
executes when the boolean expression is
false.
You can use one if or else if statement
nested if statements inside another if or else if
statement(s).
A switch statement allows a variable to
switch statement be tested for equality against a list of
values.
The ? : Operator: