0
What is class in java...?
I'm new to the programming languages.
1 Answer
+ 1
A class is nothing but a blueprint or a template for creating different objects which defines its properties and behaviors. Java class objects exhibit the properties and behaviors defined by its class. A class can contain fields and methods to describe the behavior of an object.
Methods are nothing but members of a class that provide a service for an object or perform some business logic. Java fields and member functions names are case sensitive. Current states of a classâs corresponding object are stored in the objectâs instance variables. Methods define the operations that can be performed in java programming.
Example:
public class Cube {
int length;
int breadth;
int height;
public int getVolume() {
return (length * breadth * height);
}
}