Field Declarations in Java Programming

Field Declarations in Java Programming

Previous Home Next

 

Fields may include initializers and may be modified using various modifier keywords.

The variables of a class type are its fields. Class (static) variables exist once per class.
 Instance variables exist once per instance of the class.
 


 
 final class A   // final class declaration all its methods are final
{
private int type; //field declaration
public int getType()
{
return type;
}
}

Previous Home Next