1.

What does Class.forName(“myreflection.Foo”).getInstance() return?(a) An array of Foo objects(b) class object of Foo(c) Calls the getInstance() method of Foo class(d) Foo objectThis question was posed to me in an online quiz.This key question is from Reflection API topic in division Session Management, JSP & API of Java

Answer» CORRECT option is (d) Foo object

To EXPLAIN: CLASS.forName(“myreflection.Foo”) returns the class object of Foo and getInstance() would return a NEW object.


Discussion

No Comment Found

Related InterviewSolutions