Skip to main content

Posts

Showing posts with the label Constructors

Java Classes, Object and Methods, Constructors

 Defining a class     A class is a user-defined data type or group of object with a template or blueprint that serves to define its properties. It is a logical entity. Once a class type has been define, we can create " Variables " which are similar to basic type declaration. In java, variables are termed as instance of class, which actual object. The basic form class defination is as follows: class classname [extends superclassname]{     [fields declaration]     [method declaration] } The classname and superclassname are valid java identifiers. The keyword extends indicate that superclassname properties extended into classname. It is a pert of inheritance. (We will discuss inheritance in later part.) Everything inside square brackets is optional that means we can use as per the requirements. For example, class Empty{ } In above example, the Empty class is class name. This class does not have any properties and therefor cannot do anything. A java cla...