View RSS Feed

Java Object

Declaring Classes

Rate this Entry
by , 04-26-2012 at 05:10 PM (449 Views)
Classes have been seen that are defined in this way:
Java Code:
class MyClass {
    // field, constructor, and 
    // method declarations
}
This is what is known as the class declaration. All codes are present in class body which gives out for the objects that have been created by the class. Declaration is for sake of the fields that give the state of objects and class & also the methods for implementation of the behavior of objects and class. Constructors are for sake of initialization of the new objects.

Class declaration preceding is considered to be the minimal one. Only those class declaration components are present in it which is needed. More information regarding class can be provided like superclass name, whether any interface is implemented or not, and so on, in beginning of class declaration. E.g.
Java Code:
class MyClass extends MySuperClass implements YourInterface {
    // field, constructor, and
    // method declarations
}
It means MyClass is MySuperClass subclass & implementation of YourInterface interface is done by it.

Submit "Declaring Classes" to Facebook Submit "Declaring Classes" to Digg Submit "Declaring Classes" to del.icio.us Submit "Declaring Classes" to StumbleUpon Submit "Declaring Classes" to Google

Categories
Tutorial

Comments