Keywords

This topic contains a list of key words that are used in this tutorial when describing elements in the Java code.

Keyword Definition
Nested Class A class that has been defined within another class. Nested classes take the following form in Java:
class OuterClass {

  class NestedClass {

  }
}
Member Variable A variable belonging to a class.
Method A subroutine belonging to a class.
Instance Variable A variable contained in an object.
Instance Method A subroutine contained in an object.
Constructor A constructor is used to create new objects. By default it allocates memory and initializes instance variables. Every class has at least one constructor; if a constructor definition has not been written in the class the system provides a default constructor. The following example shows a constructor that is used to set the values of the instance variables to the values of some input parameters.
public class MyClass {
 
  private int m_num1;
  private int m_num2;
 
  public MyClass(int param1, int param2) {
    m_num1 = param1;
    m_num2 = param2;
  }
}
Instantiate The process of creating an object from a class is called instantiation, since an object is an instance of a class. You can say that to create an object you must instantiate the relevant class.