Short Datatype in Java

short:
short is 16 bit signed type ranges from –32,768 to 32,767.

Syntax:
Declare short varibale as below
short <variable name> = <default value>;

Note:
here assigning default value is optional.

public class Short {
 
        public static void main(String[] args) {

                 short s1 = 50;
                 short s2 = 42;
                 
                System.out.println("Value of short variable b1 is :" + s1);
                System.out.println("Value of short variable b1 is :" + s2);
        }
}
 


Output:
Value of short variable b1 is :50
Value of short variable b1 is :42