java.lang
Class Short
java.lang.Object
|
+--java.lang.Short
- public final class Short
- extends Object
The Short class is the standard wrapper for short values.
- Since:
- JDK1.1
Field Summary |
static short |
MAX_VALUE
The maximum value a Short can have. |
static short |
MIN_VALUE
The minimum value a Short can have. |
Constructor Summary |
Short(short value)
Constructs a Short object initialized to the specified short value. |
Method Summary |
boolean |
equals(Object obj)
Compares this object to the specified object. |
int |
hashCode()
Returns a hashcode for this Short. |
static short |
parseShort(String s)
Assuming the specified String represents a short, returns that
short's value. |
static short |
parseShort(String s,
int radix)
Assuming the specified String represents a short, returns that
short's value. |
short |
shortValue()
Returns the value of this Short as a short. |
MIN_VALUE
public static final short MIN_VALUE
- The minimum value a Short can have.
- Since:
- JDK1.1
MAX_VALUE
public static final short MAX_VALUE
- The maximum value a Short can have.
- Since:
- JDK1.1
Short
public Short(short value)
- Constructs a Short object initialized to the specified short value.
- Parameters:
value
- the initial value of the Short- Since:
- JDK1.1
shortValue
public short shortValue()
- Returns the value of this Short as a short.
- Since:
- JDK1.1
hashCode
public int hashCode()
- Returns a hashcode for this Short.
- Overrides:
- hashCode in class Object
- Since:
- JDK1.1
equals
public boolean equals(Object obj)
- Compares this object to the specified object.
- Overrides:
- equals in class Object
- Parameters:
obj
- the object to compare with- Returns:
- true if the objects are the same; false otherwise.
- Since:
- JDK1.1
parseShort
public static short parseShort(String s)
throws NumberFormatException
- Assuming the specified String represents a short, returns that
short's value. Throws an exception if the String cannot be
parsed as a short. Assumes the radix is 10.
- Parameters:
s
- - the String containing the short- Returns:
- the short's value
- Throws:
- NumberFormatException - if the String does not contain a
parsable short.
parseShort
public static short parseShort(String s,
int radix)
throws NumberFormatException
- Assuming the specified String represents a short, returns that
short's value. Throws an exception if the String cannot be
parsed as a short.
- Parameters:
s
- - the String containing the shortradix
- - the radix to be used- Returns:
- the short's value
- Throws:
- NumberFormatException - if the String does not contain a
parsable short.