This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Whizlabs question doubt. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Whizlabs question doubt." Watch "Whizlabs question doubt." New topic

Whizlabs question doubt.

Alex Serna
Ranch Hand

Joined: Sep 18, 2009
Posts: 58
Hi everyone,

I found this question on a mock exam from Whizlabs and I don't really understand why it is this way:

I thought this would give a compile error since "d" is a Double and we are assigning it a Boolean. The explanation says that "d" gets redeclared. I thought that you couldn't redeclare a variable in java, that you could only shadow an existing variable...

Ankit Garg

Joined: Aug 03, 2008
Posts: 9453

This statement won't create a variable in the generated servlet file. It will be something like this

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Alex Serna
Ranch Hand

Joined: Sep 18, 2009
Posts: 58
Thank you Ankit!
It is sorta covered in the JavaRanch Style Guide.
subject: Whizlabs question doubt.
jQuery in Action, 3rd edition