Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

double type

 
reubin haz
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic