Defining Our Class : The journal syntax of class definition is as follows :
class ClassName extends SuperClassName
{
[Fields declaration]
[Method declaration]
}
Everything inside the square bracket is optional.
class Empty
{
}
C++ Programmers may note that there is no semicolon(:) at the end of the class.
Field Declaration : The fields that is declared inside a class is called instance variable because they are created whenever an object of the class is instantiated.
Instance variable are also known as member variables.
Example :
Class Rectagle
{
int length;
int breadth;
}
Instance member represent attributes and behaviour of individual objects by default all the members of the class and instance member.
class ClassName extends SuperClassName
{
[Fields declaration]
[Method declaration]
}
Everything inside the square bracket is optional.
class Empty
{
}
C++ Programmers may note that there is no semicolon(:) at the end of the class.
Field Declaration : The fields that is declared inside a class is called instance variable because they are created whenever an object of the class is instantiated.
Instance variable are also known as member variables.
Example :
Class Rectagle
{
int length;
int breadth;
}
Instance member represent attributes and behaviour of individual objects by default all the members of the class and instance member.
0 Comments:
Post a Comment