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.
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.
Thereafter its value cannot be changed during the course of the program.
EXAMPLE:
ACCESS SPECIFIERS
OBJECTS
Objects are instances of a class. A class is a blueprint and its concrete
version is established through objects.
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.
of the class.
SYNTAX:
class name object name=new class constructor( );
EXAMPLE:
Student s=new Student( );
No comments:
Post a Comment