About Question enthuware.jwpv6.2.844 :

Moderator: admin

Post Reply
dhanuddhara
Posts: 12
Joined: Fri Aug 15, 2014 10:16 am
Contact:

About Question enthuware.jwpv6.2.844 :

Post by dhanuddhara »

I knew this is a compile error. In translation phase the corresponding servlet class for the jsp page is compiled. At that time this error is discovers.

But i don't understand why question in enthuware.jwpv6.2.791 is having the answer D.
It is quiet similar to this question. If the compiler can understand the relationships between classes like in this question, it should also can identify the valid constructors of classes.

please explain me. My exam is on tomorrow.

admin
Site Admin
Posts: 10068
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.844 :

Post by admin »

This is OCJP stuff. In 2.791, Beans.instantiate method doesn't know what class it is going to instantiate until runtime. Observe that we are passing the class name as a string argument to Beans.instantiate method. The compiler doesn't evaluate such things. Compilation finds errors only with things that are known at compile time.

It is possible that at time time of writing the JSP page, the class may not even exist. That is the whole point of reflection. Obviously, compiler cannot know whether the class will exist at runtime or not. It can be known only at runtime.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 123 guests