Java Short Example Program
Chapter:
Data Types
Last Updated:
10-06-2016 12:10:52 UTC
Program:
/* ............... START ............... */
public class JavaShortExample {
public static void main(String[] args) {
short s = 30;
Short sObj1 = new Short(s);
Short sObj2 = new Short("50");
// print value of Short objects
System.out.println(sObj1);
System.out.println(sObj2);
}
}
/* ............... END ............... */
Output
Notes:
-
The short data type is a 16-bit signed two's complement integer.
- It has a minimum value of -32,768 and a maximum value of 32,767 (inclusive).
Tags
Java Short