JAVA Variables, Constants, Access Specifiers & Objects



VARIABLES


Variable is a named memory location which stores some value of a
particular datatype. Sounds Greek? Well…in layman’s terminology it is
a container which contains a value given by the user.


SYNTAX:   
dataType   variableName  = initialValue ;
EXAMPLE:
Int A=10;


INTIAL VALUES OF VALUES:








CONSTANTS
The keyword final before a variable declaration makes it a constant.
Thereafter its value cannot be changed during the course of the program.


EXAMPLE:















ACCESS SPECIFIERS
Image result for access specifiers in java


OBJECTS


Objects are instances of a class. A class is a blueprint and its concrete
version is established through objects.


THE new OPERATOR


The new operator is used to create instances of a class, that is, the objects
of the class.


SYNTAX:
class name object name=new class constructor( );
EXAMPLE:

Student s=new Student( );  

No comments:

Post a Comment