Академический Документы
Профессиональный Документы
Культура Документы
Identifiers :
1. byte
2. short
3. int , long
4. float , double
5. char
Octal : 0-7
00001 = 1 00007 = 7
00010 = 8
00011 = 9
** Control Structures
1. Loops (for , while , do-while)
2. Non loops -> decision control structures (if , if-else, switch)
int a = 3;
if(a == 3){ //true
if(a > 3){
/-/------1
}else{
//-------2 -------------------------------
}
if(a < 5){ // true
//--------3 --------------------------------
}else{
//--------4
}
Class :
1. attributes ( properties ) <---- member of a class
2. methods ( behaviour ) <---- member of a class
Array Example :
int[] ar = new int[3]; // it constructs the array with def val as 0
ar[0] = 10;
Table[] tar = new Table[3]; // it constructs the array of type table with def
val null
tar[0] = new Table();
***Access Modifier :
1. public
2. private -------------( Class level access ONLY )
3. protected
4. default ( there is no keyword as default, so if the modifier is not
applied means it is in default access )
Non-Access Modifier :
1. Abstract ( only method and class can be marked abstract )
2. Final ( methods, calss and attributes can be marked final )
final method ==> can not override
final variable ==> can be changed once init
final class ===> can not be inherited( extend )
3. static
Casting :
1. Implicit
2. Explicit
^ byte |
| short | down
Casting( implicit ) auto / loss-less
UP Casting | char<--->int ---->float |
(Explicit) | long ----> double |
Lossy
*Inheritance :
1. is-a relationship.
2. Car is-a Vehicle.
A <----- Single level ( Becoz One class has only one Parent )
^
|
|
X Y Z B <----- Single level
|
|
C
|
|
D <---- allowed
A B
| |
| |
C C <---- NOT allowed (Multi-level relationship)
X
|
|
Y
|
|
Z
Costructor :
1. if you are able to write the const---or, then java will not provide any
Cont--or.
2. In every const---or JAVA will insert a call to super Const---or.
3. super() -----> Call to super class Const---or
4. To insert the appropriate call to spuer() Const--or is in programmers
hand.. Otherwise compiler will insert a call to super as call to default super
constructor [ex : super();]
==============***===================
*Final Class
1. final class can never be extended. (<====== ***)
2. final variable can not change its value.
3. you can never override the final method.
*Abstract Class :
1. Abstract class must be subclassed.
2. You can never create the instance of a abstract class.
3. Abstract class may or may not contain the abstract methods.
4. Abstract class may also contain its own concrete(Non-abstract) methods.
NOTE : 1. You can never mark a class as abstract and final both
2. You can never mark a method as abstract and private both
***Variable
a. local --> ( inside the method )
b. instance ---> ( inside the class but outside the method ) ... Attr
c. static ---> ( it is a class specific functionality )
***Interface :
1. interface is 100% abstract super class
2. so, interface will contain only abstract methods.
3. interface methods are always public abstract.
4. variables in interface are always static and final. (they are constants)