Create Short from String in Java
Description
The following code shows how to create Short from String.
Example
//from w w w . ja va2s .co m
public class Main {
public static void main(String[] args) {
short s = 10;
Short sObj1 = new Short(s);
Short sObj2 = new Short("10");
System.out.println(sObj1);
System.out.println(sObj2);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »