Showing posts with label checked exception. Show all posts
Showing posts with label checked exception. Show all posts

Wednesday, 4 January 2012

Sun Certified Java Programmer (SCJP) Questions

Which of the choices below can legally be inserted at the "insert code here" position in the following code?


class Parent
{


public void print(int i)


{
}


}


public class Child extends Parent
{


public static void main(String argv[])
{
}


// insert code here


}


Choices:

A. public void print(int i, byte b) throws Exception {}


B. public void print(int i, long i) throws Exception {}


C. public void print(long i) {}


D. public void print(int i) throws Exception {}


E. public int print(int i)


Correct choices:

A, B, and C


Explanation: