1.

Which of the following is a method having same name as that of it’s class?(a) finalize(b) delete(c) class(d) constructorThe question was posed to me in class test.My question is from Introduction To Methods topic in chapter Classes and Methods of Java

Answer»

The CORRECT answer is (d) constructor

Best explanation: A constructor is a METHOD that initializes an object immediately upon CREATION. It has the same NAME as that of class in which it resides.



Discussion

No Comment Found

Related InterviewSolutions