Class in java
Ajay Sundar

Ajay Sundar @ajay_sundar_c3eb3bcf9f98d

About: Life Long learner Passionate about coding, cloud computing, and all things tech. I love experimenting with new tools, breaking down complex concepts, and sharing what I learn with the community.

Location:
Chennai , Tamil Nadu
Joined:
Aug 7, 2025

Class in java

Publish Date: Sep 24
1 0

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);
}
}
Enter fullscreen mode Exit fullscreen mode

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())

Comments 0 total

    Add comment