• 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

valueOf

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

There is something that i don't understand.

When you write : Integer.valueOf(1); or System.out.println( Integer.valueOf(1) ); you don't have a compilation error, but when you look at the API of Integer.valueOf you see that it takes only a String as the argument...
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Emmanuel Aron wrote:
When you write : Integer.valueOf(1); or System.out.println( Integer.valueOf(1) ); you don't have a compilation error, but when you look at the API of Integer.valueOf you see that it takes only a String as the argument...



You may be looking at an old API doc. A valueOf() method that takes an int, was added to the Integer class, with the release of Java 5. I recommend using a Javadoc that matches the version of Java that you are using -- otherwise you will be using incorrect information.

Henry
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic