Important Java Mcq 1

Which statement is true regarding an object?

a. An object is what classes instantiated are from.

b. An object is an instance of a class.

c. An object is a reference to an attribute.

d. An object is a variable.

Answer:

b. An object is an instance of a class.

Explanation

A class can create objects of itself with different characteristics. So, we can say that an object represents a specific state of the class. This is the reason why objects are called an instance of a class.

Related MCQs

Which of the following is true? 

a. In java, an instance field declared public generates a compilation error. b. int is the name of a class available in the package java.lang c.

Aniket Malik

Aniket Malik

CERTIFIED TUTOR/TRAINER WITH 300+ REVIEWS

Facing difficulty with

this concept?