Basics of java programing
Java is a pure Object oriented programming language.
Some key points related to java programming language:
1) Sequence of java file:
a) Package name ( first line of your java file if package is there excluding comments. comments can be there before package name)
b) Import statement
c) Class / Interface definition
2) java class from you want to start execution must have main which is defined like
"public static void main( String args[])"
public: every one can access or can be call from outside.
static: main is class level method anyone can call without creating object of that class .
void: no return type.
3) Java tokens: java program is collection of java tokens. tokens are separated by white space ( white space in java is: space, new line and tab)
five types of token java
a) Keywords : Reserved key words of java programming
b) Identifiers : Words used in a java for variable , class, method, interface names
c) Constant/ Literals : Literals are values which is assign to a variable or rvalue of expression like a int '44'
d) Operators: use to solve java expiration
e) Separators: java have separators = ; : , . () [] {}
Data types:
a) primitive data type: int , byte, short, long, float, double, Boolean, char;
b) Non-primitive data type ; Build in class/ interface or user defined program.
Variables: a) Local variables
b) Instance or non-static variables
c) Static variables
a) local variable: Java don't have globule variables. In java local variable need to be initialized explicitly before using otherwise it throws error. multiple definition of a variable is not allowed. if a outer block have a variable then same variable can't be defined in inner block.
{ int a;
{ int a; }
} it will give a error.
Some key points related to java programming language:
1) Sequence of java file:
a) Package name ( first line of your java file if package is there excluding comments. comments can be there before package name)
b) Import statement
c) Class / Interface definition
2) java class from you want to start execution must have main which is defined like
"public static void main( String args[])"
public: every one can access or can be call from outside.
static: main is class level method anyone can call without creating object of that class .
void: no return type.
3) Java tokens: java program is collection of java tokens. tokens are separated by white space ( white space in java is: space, new line and tab)
five types of token java
a) Keywords : Reserved key words of java programming
b) Identifiers : Words used in a java for variable , class, method, interface names
c) Constant/ Literals : Literals are values which is assign to a variable or rvalue of expression like a int '44'
d) Operators: use to solve java expiration
e) Separators: java have separators = ; : , . () [] {}
Data types:
a) primitive data type: int , byte, short, long, float, double, Boolean, char;
b) Non-primitive data type ; Build in class/ interface or user defined program.
Variables: a) Local variables
b) Instance or non-static variables
c) Static variables
a) local variable: Java don't have globule variables. In java local variable need to be initialized explicitly before using otherwise it throws error. multiple definition of a variable is not allowed. if a outer block have a variable then same variable can't be defined in inner block.
{ int a;
{ int a; }
} it will give a error.
Comments
Post a Comment