A class is a description of an object that has not yet been created, like a general template consisting of fields, methods, and a constructor, and an object is an instance of a class created on the basis of this description.
// this is class Student
public class Student {
private String name, group, specialty;
public Student(String name, String group, String specialty) {
this.name = name;
this.group = group;
this.specialty = specialty;
}
}
public static void main(String[] args) {
//this is an object of class Student
Student student = new Student("John", "1124", "programming");
}
Comments
Leave a comment