Tuesday, 31 October 2017

#4. SCJP/OCJP Exams Questions & Answers-


4. class Test
{
public static void main(String[] args)
{
Integer i=254;
byte b=(byte)(int)i;
System.out.println(b);
}
}
what is the output of above program?

A. compile time error
B. Run time error
C. -2
D. 254
E. -1




Correct Answer: C

No comments:

Post a Comment

#45 to #51 SCJP/OCJP Exams Questions & Answers-

45. Given: 1. public class A { 2. public void doit() { 3. } 4. public String doit() { 5. return "a"; 6. } 7. ...