wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Val mock Q21 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Val mock Q21" Watch "Val mock Q21" New topic
Author

Val mock Q21

Kareem Qureshi
Ranch Hand

Joined: Mar 14, 2002
Posts: 102
Hi, Val
Can you explain the answer in Q21 in more detail, because i feel that getBoolean method can never return true. I think (int)Math.random*2 will always be equal to 0. If u see the javadocs, random()
Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0. Returned values are chosen pseudorandomly with (approximately) uniform distribution from that range.
am I missing something here?
Please correct me
thanks in advance
kareem
Kareem Qureshi
Ranch Hand

Joined: Mar 14, 2002
Posts: 102
Sorry
i figured out where i am wrong because anything greater than .5 will make the expression return value greater than 1
kareem
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Val mock Q21
 
Similar Threads
xsl processing question
Question 21 by Sreenivasa Kumar Majji
Constructors
mock question
Please explain the output of this code snippet