Home » JAVA Programming » Object & Classes » Question
  1. What is the output of this program?
    public class Result 
    {
    public static void main(String args[])
    {
    Integer n = new Integer(260);
    byte p = n.byteValue();
    System.out.print(p);
    }
    }
    1. 0
    2. 1
    3. 2
    4. 3
    5. 4
Correct Option: E

n.byteValue() method returns the value of wrapper i as a byte value. n is 260, range of byte is 256 therefore n value exceeds byte range by 4 hence 4 is returned and stored in p.



Your comments will be displayed only after manual approval.