0 votes
in JAVA by
What is a class ?

Classes are fundamental or basic unit in Object Oriented Programming .A class is kind of blueprint or

template for objects. Class defines variables, methods. A class tells what type of objects we are creating.

For example take Department class tells us we can create department type objects. We can create any

number of department objects.

All programming constructs in java reside in class. When JVM starts running it first looks for the class

when we compile. Every Java application must have atleast one class and one main method.

Class starts with class keyword. A class definition must be saved in class file that has same as class name.

File name must end with .java extension.

public class FirstClass

{public static void main(String[] args)

{System.out.println(“My First class”);

}

}

If we see the above class when we compile JVM loads the FirstClass and generates a .class

file(FirstClass.class). When we run the program we are running the class and then executes the main

method.

Related questions

+1 vote
asked Jul 5, 2019 in JAVA by Robindeniel
0 votes
asked Jun 17, 2019 in JAVA by reins.robin
...