lstkkk(牛虻) 说的是正确的,但是SUN公司要求不要用一个类的实例即对象来访问类的静态方法即类方法;
当然类方法或类属性是属于整个类的,类的对象也可以调用,但为了在实际的编程中不产生混淆,要求不要通过对象来访问类方法;但通过类来访问类属性是可以的。
当然类方法或类属性是属于整个类的,类的对象也可以调用,但为了在实际的编程中不产生混淆,要求不要通过对象来访问类方法;但通过类来访问类属性是可以的。
getInteger
public static Integer getInteger(String nm)Determines the integer value of the system property with the specified name.
The first argument is treated as the name of a system property. System properties are accessible through the System.getProperty(java.lang.String) method. The string value of this property is then interpreted as an integer value and an Integer object representing this value is returned. Details of possible numeric formats can be found with the definition of getProperty. 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. In other words, this method returns an Integer object equal to the value of: getInteger(nm, null) Parameters:
nm - property name.
Returns:
the Integer value of the property.
See Also:
System.getProperty(java.lang.String), System.getProperty(java.lang.String, java.lang.String)
getInteger
public static Integer getInteger(String nm,
int val)Determines the integer value of the system property with the specified name.
The first argument is treated as the name of a system property. System properties are accessible through the System.getProperty(java.lang.String) method. The string value of this property is then interpreted as an integer value and an Integer object representing this value is returned. Details of possible numeric formats can be found with the definition of getProperty. The second argument is the default value. An Integer object that represents the value of the second argument is returned if there is no property of the specified name, if the property does not have the correct numeric format, or if the specified name is empty or null. In other words, this method returns an Integer object equal to the value of: getInteger(nm, new Integer(val))
but in practice it may be implemented in a manner such as:
Integer result = getInteger(nm, null);
return (result == null) ? new Integer(val) : result;
to avoid the unnecessary allocation of an Integer object when the default value is not needed. Parameters:
nm - property name.
val - default value.
Returns:
the Integer value of the property.
public static Integer getInteger(String nm,
Integer val)Returns the integer value of the system property with the specified name. The first argument is treated as the name of a system property. System properties are accessible through the System.getProperty(java.lang.String) method. The string value of this property is then interpreted as an integer value, as per the Integer.decode method, and an Integer object representing this value is returned. If the property value begins with the two ASCII characters 0x or the ASCII character #, not followed by a minus sign, then the rest of it is parsed as a hexadecimal integer exactly as by the method valueOf(java.lang.String, int) with radix 16.
If the property value begins with the ASCII character 0 followed by another character, it is parsed as an octal integer exactly as by the method valueOf(java.lang.String, int) with radix 8.
Otherwise, the property value is parsed as a decimal integer exactly as by the method valueOf(java.lang.String, int) with radix 10.
The second argument is the default value. The default value is returned if there is no property of the specified name, if the property does not have the correct numeric format, or if the specified name is empty or null.
Parameters:
nm - property name.
val - default value.
Returns:
the Integer value of the property.
好的,都是JAVA同路人,祝你JAVA学习旅途愉快!