1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
/* Java short Example This Java Example shows how to declare and use Java primitive short variable inside a java class. */ public class JavaShortExample { public static void main(String[] args) { /* * short is 16 bit signed type ranges from –32,768 to 32,767. * * Declare short varibale as below * * short <variable name> = <default value>; * * here assigning default value is optional. */ 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 would be Value of short variable b1 is :50 Value of short variable b1 is :42 */ |
Add Comment