0
Please anyone explain me class with one example.
I am unable to understand what is a class
2 Answers
+ 5
<k>~~~~~~~~~~~~</k>
class is the basic concept of OOPs. A class is defined as a blueprint/prototype. You can create an individual object by use of a class. A class can represent the set of properties and methods they are common for all the objects of a class.
In Java class, we define a pattern/blueprint which is followed by every object. Before moving further we must need to know what does java class consists? Whatâs the mean of blueprint here? Here is the blueprint print of java class that consists of a number of things.
For more details with example: https://javagoal.com/class-and-object-in-java/
0
Class contains data and methods in java..
In java, data and methods resides in class.
class A
{
int i =1;
public void print() (
System.out.println("hello" + i ) ;
}
}
Here A is Class,
And print is a method, Prints some text with i value..