DEV Community

AmalaReegan
AmalaReegan

Posted on

Day3 Class and object in java:

CLASS:

*.A class in Java is a blueprint or template for creating objects
*.It defines the properties (attributes) and behaviors (methods) that the objects created from it will have
*.A class encapsulates data for the object and methods to manipulate that data

OBJECT:

*.An object is an instance of a class
*.It is created from the class blueprint and holds actual values in its fields (attributes)
*.Objects can access the methods of the class to perform actions
*.You can create an object by using the new keyword, which calls the constructor of the class to instantiate an object

Top comments (0)