• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Wrapper classes doubt?

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

The below question is from Dan Chisholm's website,


Answer is given as K. I'm confused. Please help!
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I could think of a problem only in line 5. But that too when I tried, there was no error and i could see .1e1d is taken as (.1 * pow(10,1)) = 1.0.
Similarly, .1e2d is treated as (.1 * pow(10, 2)) = 10.0.
 
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Go thru' the below link:
3.10.2 Floating-Point Literals - JLS
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi jothi,

no probs at all.......above code compile and run
with output
1) 1.0
2) 1.0
3) 1.0
4) 10.0
5) 1.0

because--->>

"All the wrapper classes except Character have two constructors -- one that takes the primitive value and another that takes the String representation of the value. For instance:"

Integer i1 = new Integer(50);
Integer i2 = new Integer("50");
reply
    Bookmark Topic Watch Topic
  • New Topic