Question: Hello everyone, This is java, why short shortX, print the number as -128 instead of 128 , byte prints it -128 because it can store
Hello everyone,
This is java,
why short shortX, print the number as -128 instead of 128 , byte prints it -128 because it can store only from -128-127, but short can store a much larger values than byte, why the result of shortX is -128 instead of 128?

7 8 9 //bytex has 0111 1111; 10 byte byteX = (byte) 128; 011 short shortX; 12 shortX= byteX; 13 14 System.out.println(bytex); 15 16 17 Problems @ Javadoc Declaration Console X
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
