aspose file tools
The moose likes Beginning Java and the fly likes Short sh =  new Short( 2); is indefined? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Short sh =  new Short( 2); is indefined?" Watch "Short sh =  new Short( 2); is indefined?" New topic
Author

Short sh = new Short( 2); is indefined?

Nikos Stavros
Ranch Hand

Joined: Feb 24, 2006
Posts: 243

I don't understand why in my code


is indefined?


Jesus lives
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Because there is no constructor in the Short class which takes an int value as a parameter. This will work:


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Martin Simons
Ranch Hand

Joined: Mar 02, 2006
Posts: 196
well, Short can only be declared with a string or a short. Since a number
typed in the manner it is there is, per default, an integer, that
constructor is not defined. Fix in one of these two ways:
Nikos Stavros
Ranch Hand

Joined: Feb 24, 2006
Posts: 243

of course

thanks guys
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Short sh = new Short( 2); is indefined?
 
Similar Threads
DB: Keeping track of deleted records
Remembering range of primitives?
Dan's Q doubt again?
Type Conversion doubt
Implicit casting with primitives/wrapper classes