Using int Data Type

Practise your skills and try to change the code. Read the comments and try what is within the TODO comment.

class ShortDemo {
    public static void main (String[] args) {
        //short type stores values in the range from -32768 to 32767
        //This data type is rarely used in Java
        //Instead use an int data type
        short maximumMessageLength = 5000;
        System.out.println("maximumMessageLength value is " + maximumMessageLength);

        //Try changing the value of maximumMessageLength to 32768 and Run again
        //What happened?

results matching ""

    No results matching ""