File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes double type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "double type" Watch "double type" New topic
Author

double type

reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287


This is from K&B book. I don't know why option 4 '42e7' is a double. Can someone explain this? Thanks


SCJA, SCJP5.0, SCBCD, SCWCD
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Because the "e7" means "10 to the power 7". So the number 47e7 means 42.0 times 10000000 or 420000000.0. The number 47e7 is therefore considered to be a literal double constant.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: double type
 
Similar Threads
literal question
Assignment to float
Why is "float f4 = 42e7" not considered a valid declaration of a float in Java?
See this question
float and double range