Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Take Free Test
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Take Free Test
Inner Classes Questions
Java — Create an instance of a non-static member inner class from outside its outer class: class Foo { class Bar { } } class Test { public static void main (String [] args) { Foo f = new Foo(); /* Line 10: Missing statement? */ } }
Java — Identify which statements actually construct an anonymous inner class instance (Runnable example)
Java — Create an anonymous inner class instance within a subclass method: class Boo { Boo(String s) { } Boo() { } } class Bar extends Boo { Bar() { } Bar(String s) { super(s); } void zoo() { // insert code here } }
Java — Truths about anonymous inner classes (capabilities and limitations)
Java — Properties of a method-local inner class (what modifiers are allowed?)
In Java, consider the following nested type: public class MyOuter { public static class MyInner { public static void foo() { } } } Which statement, when written from some other class (not MyOuter or MyInner), correctly instantiates the static nested class MyOuter.MyInner?
In Java, which statement about a static nested class is correct?