Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help in initializing wrapper objects

 
Sugantha Jeevankumar
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the following code snippet, the compiler shows error on both of the bolded lines



Why does this happen? But when I call the constructor using "new Double(9)" it works fine...Please help
Thanks in Advance.
 
Lucas Lech
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sometimes it can be useful to actually check the compiler error

first line gives you 'cannot convert from int to Double'
second one gives 'cannot convert from float to Double'

try this one:

Double myDouble = 9d;

Cheers,
[ December 11, 2007: Message edited by: Lucas Lech ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic