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






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

   


public class Main {

  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);
  }
}
/*
Value of short variable b1 is :50
Value of short variable b1 is :42
*/

   
    
    
  








Related examples in the same category

1.Java Short Example
2.Convert Java String to Short
3.Short class creates primitives that wrap themselves around data items of the short data type
4.Use toString method of Short class to convert Short into String.
5.Use Short constructor to convert short primitive type to Short object
6.short value
7.Convert Short to numeric primitive data types
8.Convert String to short primitive
9.Compare Two Java short Arrays
10.Java Sort short Array
11.Cast back to short
12.Cast result of plus operation to byte
13.Shorts Vs IntsShorts Vs Ints
14.Gets the maximum of three short values.
15.Gets the minimum of three short values.
16.Convert int and short to bytes