Class
Class — is a blueprint or template for creating objects. It defines the structure (attributes) and behavior (methods) that an object will have.
public class Car {
// Fields (attributes or properties)
String color;
int speed;
// Methods (behavior)
void drive() {
System.out.println("The car is driving.");
}
} It defines the structure (attributes) and behavior (methods) that an object will have.
Semantic portal