Class
A class and is a blueprint or template for creating object
Inside a class there will be variables and methods
Without a class we will not be able to create an object
Example for an class
class Car{
String brand;
int speed;
void display();
System.out.println("Brand:" +"Speed":+Speed);
}
}
Class Explanation
Car is a class
It has two data types which are String and int
It has two variables brand and speed
it has one method (display())
Top comments (0)