Question: 1)Given the following code snippet: public void displayV3(char init) { newChar=init; ActionListener displayer =new ActionListener() { public void actionPerformed(ActionEvent e) { newChar++; System.out.println(New Character:
1)Given the following code snippet:
public void displayV3(char init)
{
newChar=init;
ActionListener displayer =new ActionListener() {
public void actionPerformed(ActionEvent e) {
newChar++;
System.out.println("New Character: " + newChar);
}
};
Timer t=new Timer(1000, displayer);
t.start();
}
We have --------------------------------------- defined in the method named displayV3(char init).
a.
None of these
b.
One anonymous inner class
c.
One method local inner class
d.
No inner classes
2)
In the following statement:
public abstract class Vehicle extends DD implements Car{ . . . }
Vehicle must implement all non-default methods in Vehicle
Select one:
True
False
3)
If you write your class with even a single constructor of your own and you want the users of your class to have the ability to create an instance by a call to:
new ClassName(), then you must provide a no-argument constructor.
Select one:
True
False
4)
Given the following code snippet:
ArrayList
Scanner scan1=new Scanner(new File("D:\\AAUJ\\AAA\ adiusInfo.txt")); //This statement is equivalent to Scanner scan1=new Scanner(new FileInputStream("D:\\AAUJ\\AAA\ adiusInfo.txt"));
while(scan.hasNext())
{
double radius;
scan.next();
radius=Double.parseDouble(scan.next());
shapes.add(new Circle(radius));
}
Select one:
a.
None of these
b.
The compiler will report an error if Shape class does not extend Circle class
c.
The compiler will report an error if Circle class does not extend Shape class
d.
The compiler will report an error
5)
In the following code:
public void displayAddress(Address add) {
System.out.println(add.toString());
}
add is an object in memory that belongs to Address class.
Select one:
True
False
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
