adplus-dvertising
frame-decoration

Question

Which of the following is a valid declaration of an object of class Box?

a.

Box obj = new Box();

b.

Box obj = new Box;

c.

obj = new Box();

d.

new Box obj;

Posted under Java Programming

Answer: (a).Box obj = new Box();

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which of the following is a valid declaration of an object of class Box?

Similar Questions

Discover Related MCQs

Q. Which of these operators is used to allocate memory for an object?

Q. Which of these statement is incorrect?

Q. Which of the following statements is correct?

Q. What is the return type of a method that does not return any value?

Q. What is the process of defining more than one method in a class differentiated by method signature?

Q. Which of the following is a method having same name as that of it’s class?

Q. Which method can be defined only once in a program?

Q. Which keyword is used by the method to refer to the object that invoked it?

Q. Which of the following is a method having same name as that of its class?

Q. Which operator is used by Java run time implementations to free the memory of an object when it is no longer needed?

Q. Which function is used to perform some action when the object is to be destroyed?

Q. What is true about private constructor?

Q. What would be the behaviour if this() and super() used in a method?

Q. What is false about constructor?

Q. What is true about Class.getInstance()?

Q. What is true about constructor?

Q. Abstract class cannot have a constructor.

Q. What is true about protected constructor?

Q. What is not the use of “this” keyword in Java?

Q. What would be the behaviour if one parameterized constructor is explicitly defined?