Question
1. Which of the following is true about the anonymous inner class? Select one: a. It has only methods b. Objects can't be created c.
1.
Which of the following is true about the anonymous inner class?
Select one:
a.
It has only methods
b.
Objects can't be created
c.
It has no class name
d.
It has a fixed class name
2.
All of the following methods can be defined in one single interface:
default void printContent(T[] objects)
{
for(T t:objects)
{
System.out.println(t.toString());
}
}
default void printContent(ArrayList
{
for(T t:objects)
{
System.out.println(t.toString());
}
}
default void printContent(HashMap
{
for(HashMap.Entry
{
System.out.println("Key = " + entries.getKey() + " , Value = " + entries.getValue());
}
}
Select one:
True
False
3.
The following statement is used to declare and instantiate an ArrayList of Car objects.
ArrayList
Select one:
True
False
4.
All Wrapper classes are immutable in Java except StringBuilder class
Select one:
True
False
5.
he following code will produce a compilation error unless:
public interface Shape extends Comparable
}
Select one:
a.
None of the these
b.
Car class is defined in the same project folder
c.
Car class is defined in the same package
d.
Both Comparable and Car are defined in the same package
6.
A class can include a definition of an interface.
Select one:
True
False
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started