What is the java class?
Class is a blueprint of the object or set of instructions for creating a specific type of object. Class is like an object constructor.
public class UserName{
int id;
String name;
int age;
public void run(){
System.out.println("I'm Running");
}
}
What is the java object?
The object is an instance of the class.
Ex:-
public class Main{
public static void main(String args[]){
UserName user = new UserName();
}
Learned a lot, thank you.
ReplyDeletethankx bocca
Delete