1. Write main function in class
  2. Declare an object of a class
  3. Instantiate object
  4. Access class members using object
  5. Explain the use of dot operator
  6. Explain the use of new keyword
  7. Initialize the property of class in class declaration

Object Declaration and Access Class Members in JAVA Video Tutorial (Hindi)

Vineet Agrawal

Published on January 7, 2017

Syntax to declare an object for a class is

<class_name> <object_name>;

new keyword is used to instantiate class object. Syntax to instantiate an object is:

<object_name> = new <class_name>

dot (.) operator is required to access class members using object. Syntax to access a class member is:


class employee
	  int empID=5;
	  void showEmpID()
	  public static void main(String args[])
		  employee e; // object declaration
		  e=new employee();
This content is part of the following course: 
Frequently Asked Questions
Required Components