Answer to Question #125265 in Java | JSP | JSF for Lebenis

Question #125265

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-07-07T09:55:52-0400

Example of the class:


class Shirt{

private int size;

public Shirt (int size){
this.size = size;
}

}

Example of creating the object:

Shirt medium = new Shirt(10);

A class is a description of an entity.

An object is an instance of a class.

In order to use the functionality of a class(in general), you must create an object of this class.

In the example above, the object is created using the keyword "new".


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
APPROVED BY CLIENTS