Which is true about an anonymous inner class?

Day 10 - Inner class

Quiz
•
Professional Development
•
Professional Development
•
Hard
Nirmala Sherine
Used 8+ times
FREE Resource
Student preview

5 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
It can extend exactly one class and implement exactly one interface.
It can extend exactly one class and can implement multiple interfaces.
It can extend exactly one class or implement exactly one interface.
It can implement multiple interfaces regardless of whether it also extends a class.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which statement is true about a static nested class?
You must have a reference to an instance of the enclosing class in order to instantiate it.
It does not have access to nonstatic members of the enclosing class.
It's variables and methods must be static.
It must extend the enclosing class.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
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?
Foo.Bar b = new Foo.Bar();
Foo.Bar b = f.new Bar();
Bar b = new f.Bar();
Bar b = f.new Bar();
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
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?
MyOuter.MyInner m = new MyOuter.MyInner();
MyOuter.MyInner m = new MyOuter.MyInner();
MyOuter m = new MyOuter();
MyOuter.MyInner mi = m.new MyOuter.MyInner();
MyOuter m = new MyOuter();
MyOuter.MyInner mi = m.new MyOuter.MyInner();
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which among the following best describes a nested class?
Class inside a function
Class inside a package
Class inside a structure
Class inside a class
Popular Resources on Quizizz
15 questions
Multiplication Facts

Quiz
•
4th Grade
25 questions
SS Combined Advisory Quiz

Quiz
•
6th - 8th Grade
40 questions
Week 4 Student In Class Practice Set

Quiz
•
9th - 12th Grade
40 questions
SOL: ILE DNA Tech, Gen, Evol 2025

Quiz
•
9th - 12th Grade
20 questions
NC Universities (R2H)

Quiz
•
9th - 12th Grade
15 questions
June Review Quiz

Quiz
•
Professional Development
20 questions
Congruent and Similar Triangles

Quiz
•
8th Grade
25 questions
Triangle Inequalities

Quiz
•
10th - 12th Grade