Page 1 of 1

About Question enthuware.jwpv6.2.836 :

Posted: Sun Jan 26, 2014 11:09 pm
by alayor
I think the representation of a null value as a string is an empty string "".
So the answer should be the third option.

Re: About Question enthuware.jwpv6.2.836 :

Posted: Mon Jan 27, 2014 5:50 am
by admin
You are probably referring to EL. In this case, however, a simple java + operation is performed on a String and a null reference (request.getAttribute("filterParam") is returning null here). So null will be printed.

Re: About Question enthuware.jwpv6.2.836 :

Posted: Fri Feb 14, 2014 5:09 pm
by DISRUPTOR
what about with the casting in this instruction?

......" + request.getAttribute("filterParam") ); ?????

Re: About Question enthuware.jwpv6.2.836 :

Posted: Fri Feb 14, 2014 8:35 pm
by admin
I am not sure what you mean. I don't see any cast anywhere.

Re: About Question enthuware.jwpv6.2.836 :

Posted: Sun Feb 16, 2014 8:26 am
by DISRUPTOR
sorry for my poor English.

my question is:
Is not necessary to make a casting before this instruction?

//code for doGet of DestinationServlet     
...
    System.out.println("Param Added by SimpleFilter : " [...(String) casting here...]+ request.getAttribute("filterParam") );     }

Would not it be a compilation error?

Thank you!

Re: About Question enthuware.jwpv6.2.836 :

Posted: Sun Feb 16, 2014 8:55 am
by admin
No, the cast is not needed. Why do you think a cast is required? I am asking because you might be missing a fundamental concept which is already covered in OCAJP/OCPJP.

HTH,
Paul.