Online Software Educational Training - IT Tutorials - Online Education Training for Computer Software


Home

JAVA PROGRAMMING

Class Fundamentals

Introduction to Class

Class have been used since the beginning of this tutorial. Perhaps the most important thing to understand about a class is that it defines a new data type. Once defined, this new type can be used to create objects of that type. 

When you define a class, you declare its exact form and nature. You do this by specifying the data that it contains and code that operates on that data. While very simple classes may contain only code or data, most real-world classes contain both.

 A class is declared by use of the class keyword. The classes that have been used up to this point are actually very limited examples of its complete form.

The general form of the class:

class classname {

type instance-variable1;

type instance-variable2;

type methodname(parameter list) {

}

}

 

 


Previous

Next