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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "double type" Watch "double type" New topic

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

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.
Don't get me started about those stupid light bulbs.
subject: double type