• 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

What is getInteger for?

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody.
Can anyone explain what are
public static Integer getInteger(String nm)
public static Integer getInteger(String nm, int val) for?
In Java 2 SDK, Standard Edition Documentation I have read this:
getInteger determines the integer value of the system property with the specified name.
If there is no property with the specified name, if the specified name is empty or null, or if the property does not have the correct numeric format, then null is returned.
I have tested on my computer (OS -Windows 98) this program:
import java.util.*;
class Test {
public static void main(String[] args) {
Properties prop = new Properties();
prop = System.getProperties();
for(Enumeration enum = prop.propertyNames(); enum.hasMoreElements(); ) {
System.out.println(Integer.getInteger((String)enum.nextElement()));
}
}
}
The result was a list of null-s.
So if all integer value of the system property are null what are getInteger for?
Thank you very much. :roll:
[ October 02, 2002: Message edited by: ArthurClarke ]
[ October 02, 2002: Message edited by: ArthurClarke ]
[ October 02, 2002: Message edited by: Arthur Clarke ]
[ October 02, 2002: Message edited by: Arthur Clarke ]
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ArthurClarke,
Welcome to Javaranch
We'd like you to read the Javaranch Naming Policy and change your publicly displayed name (change it here) to comply with our unique rule. Thank you.
PS: Quote from the naming policy:


For your publicly displayed name, use a first name, a space, and a last name. Obviously fictitious names or improperly formatted names may be locked out.


PS: Adding a space between Arthur and Clarke would be perfect
 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It means there are no properties in your environment that can be represented by an Integer. Try passing an optional parameter, say -DTEST=5
 
Arthur Clarke
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you, Vin Kris.
It works!!!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic