About Question enthuware.jwpv6.2.836 :

Moderator: admin

Post Reply
alayor
Posts: 5
Joined: Sun Jan 05, 2014 6:19 pm
Contact:

About Question enthuware.jwpv6.2.836 :

Post 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.

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

Re: About Question enthuware.jwpv6.2.836 :

Post 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.
If you like our products and services, please help us by posting your review here.

DISRUPTOR
Posts: 2
Joined: Mon Feb 10, 2014 2:09 pm
Contact:

Re: About Question enthuware.jwpv6.2.836 :

Post by DISRUPTOR »

what about with the casting in this instruction?

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

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

Re: About Question enthuware.jwpv6.2.836 :

Post by admin »

I am not sure what you mean. I don't see any cast anywhere.
If you like our products and services, please help us by posting your review here.

DISRUPTOR
Posts: 2
Joined: Mon Feb 10, 2014 2:09 pm
Contact:

Re: About Question enthuware.jwpv6.2.836 :

Post 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!

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

Re: About Question enthuware.jwpv6.2.836 :

Post 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.
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 15 guests