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

30
50

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

Similar Programs Chapter Last Updated
Java String Example Program Data Types 19-06-2016
Primitive Datatypes In Java Example Data Types 17-06-2016
Enum In Java Example Data Types 28-04-2016
Java Long Example Program Data Types 15-07-2016
Java Int Example Program Data Types 06-07-2016
Int Array In Java Example Program Data Types 09-06-2016
Java Float Program Example Data Types 28-03-2017
Java Double Example Program Data Types 28-03-2017
Java Char Example Program Data Types 28-03-2017
Java Byte Example Program Data Types 28-03-2017
Java Boolean Example Program Data Types 28-03-2017

1