Answer to Question #113885 in Java | JSP | JSF for Oladepo

Question #113885
Give an example of a class and an example of an object. Describe what a class is, what an object is, and how they are related. Use your examples to illustrate the descriptions.
1
Expert's answer
2020-05-05T03:47:46-0400

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");
    }

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS