The Short
class in Java is a wrapper class for the primitive type short
. It provides a variety of methods for converting a short to a string and a string to a short, as well as other constants and methods useful when dealing with a short. Understanding these methods is crucial for efficient short manipulation in Java.
This guide covers various methods available in the Short
class, offering a comprehensive understanding of how to manipulate and interact with short values in Java. These methods are essential for efficient coding practices and help in performing operations like parsing, comparing, and converting short values.
For more detailed information, you can refer to the official Java SE Documentation and additional resources on Java Programming Tutorial.
Java Short Class Methods
Method | Description |
---|---|
byteValue() | Returns the value of this Short as a byte. |
compareTo() | Compares two Short objects numerically. |
doubleValue() | Returns the value of this Short as a double. |
floatValue() | Returns the value of this Short as a float. |
longValue() | Returns the value of this Short as a long. |
intValue() | Returns the value of this Short as an int. |
shortValue() | Returns the value of this Short as a short. |
parseShort() | Parses the string argument as a signed decimal short. |
toString() | Returns a string representation of this Short value. |
valueOf() | Returns a Short instance representing the specified short value. |
References: