JAVA is a truly object oriented programming language. You can’t even write main function without class. Hence, it is necessary to learn to declare a class in JAVA. In this video Mr. Vineet Agrawal will show you how to declare a class in JAVA.

After watching this video you will be able to-

  • – Declare a class in JAVA
  • – Choose correct name for the class in JAVA
  • – Explain the structure of a class
  • – Define class properties
  • – Define class methods

Syntax of class in JAVA

class class_name{
}

Basic structure of class

Class contains properties (member variables) and behavior (member function).
The java code given below shows a class with member variables and member functions.

class Employee{
int empID; //member variable
void setInfo(){  //member function with blank body.
}
}
SHARE
Previous articleException handling using Try Catch in JAVA
Next articleHow to set background color of an Applet in JAVA

An educational consultant
Vineet Agrawal is a director and founder of Solution Center, Agra. He has been providing training for last 17 years. He has trained 1000s of students of the software industry. He has been actively involved in final year projects of B.Tech. (CS /IT). The programs included in this video series are based on his experience of teaching that will help you in cracking a java interview.

Leave a Reply