Java Variables
Java Variable Are Divided Into Two Categories:
Primitive Variables: Primitive Variables are those variables which can be used to represent primitive value such type of variable is considered as primitive variables.
Eg: int x =10 ;
x contain 10
Here x represents as variables.
Reference Variables: Reference Variables are those variables which can be used to represent a Reference such type of variable is considered as Reference variables.
Eg:
Class Student{
String name = "Dileep Kumar";
public static void main (String [] args){
Student s = new Student();
System.out.println(s.name);
}
}
Above (s) is a reference variable.
New Keyword is used for creating a new object.
No comments:
Post a Comment