1. Question: Which is true about an anonymous inner class? 

    A
    It can extend exactly one class and implement exactly one interface.

    B
    It can extend exactly one class and can implement multiple interfaces.

    C
    It can extend exactly one class or implement exactly one interface.

    D
    It can implement multiple interfaces regardless of whether it also extends a class.


    1. Twitter
    2. Details
  2. Question: class Boo { Boo(String s) { } Boo() { } } class Bar extends Boo { Bar() { } Bar(String s) {super(s);} void zoo() { // insert code here } } which one create an anonymous inner class from within class Bar? 

    A
    Boo f = new Boo(24) { };

    B
    Boo f = new Bar() { };

    C
    Bar f = new Boo(String s) { };

    D
    Boo f = new Boo.Bar(String s) { };


    1. Twitter
    2. Details
  3. Question: Which is true about a method-local inner class? 

    A
    It must be marked final.

    B
    It can be marked abstract.

    C
    It can be marked public.

    D
    It can be marked static.


    1. Twitter
    2. Details
  4. Question: Which statement is true about a static nested class? 

    A
    You must have a reference to an instance of the enclosing class in order to instantiate it.

    B
    It does not have access to nonstatic members of the enclosing class.

    C
    It's variables and methods must be static.

    D
    It must extend the enclosing class.


    1. Twitter
    2. Details
  5. Question: Which constructs an anonymous inner class instance? 

    A
    Runnable r = new Runnable() { };

    B
    Runnable r = new Runnable(public void run() { });

    C
    Runnable r = new Runnable { public void run(){}};

    D
    System.out.println(new Runnable() {public void run() { }});


    1. Twitter
    2. Details
  6. Question: class Foo { class Bar{ } } class Test { public static void main (String [] args) { Foo f = new Foo(); /* Line 10: Missing statement ? */ } } which statement, inserted at line 10, creates an instance of Bar? 

    A
    Foo.Bar b = new Foo.Bar();

    B
    Foo.Bar b = f.new Bar();

    C
    Bar b = new f.Bar();

    D
    Bar b = f.new Bar();


    1. Twitter
    2. Details
  7. Question: public class MyOuter { public static class MyInner { public static void foo() { } } } which statement, if placed in a class other than MyOuter or MyInner, instantiates an instance of the nested class? 

    A
    MyOuter.MyInner m = new MyOuter.MyInner();

    B
    MyOuter.MyInner mi = new MyInner();

    C
    MyOuter m = new MyOuter(); MyOuter.MyInner mi = m.new MyOuter.MyInner();

    D
    MyInner mi = new MyOuter.MyInner();


    1. Twitter
    2. Details
  8. Question: What is the value of "d" after this line of code has been executed? double d = Math.round ( 2.5 + Math.random() ); 

    A
    2

    B
    3

    C
    4

    D
    2.5


    1. Twitter
    2. Details
  9. Question: Which of the following would compile without error? 

    A
    int a = Math.abs(-5);

    B
    int b = Math.abs(5.0);

    C
    int c = Math.abs(5.5F);

    D
    int d = Math.abs(5L);


    1. Twitter
    2. Details
  10. Question: Which of the following are valid calls to Math.max? Math.max(1,4) Math.max(2.3, 5) Math.max(1, 3, 5, 7) Math.max(-1.5, -2.8f) 

    A
    1, 2 and 4

    B
    2, 3 and 4

    C
    1, 2 and 3

    D
    3 and 4


    1. Twitter
    2. Details