Quiz 7 Flashcards
What is the output of the following code:
class A{
public void p(){
System.out.println(“1”);
}
public void q(){
System.out.println(“2”);
}
public void r(){
p();
}
}
class B extends A{
public void p(){
System.out.println(“3”);
}
}
class C extends B{
public void q(){
System.out.println(“4”);
}
}
public class QuizMain {
public static void main(String[] args) { A a = new C(); a.r(); }
}
3, 4, 2, or 1?
3
When there is a method overloading in Java, the method that gets called is always determined at run-time based on the method signature, T/F?
False
Java does not support operator overloading, T/F?
True
Constructors in Java must have a return type of void, T/F?
False
Simula is the first purely object-oriented language. Everything in Simula is an object, including numbers and code itself, T/F?
False
What is the output of the following Java code:
String a = new String(“hello”);
String b = new String(“hello”);
System.out.println(a == b);
True or false?
False
Which of the following class does not implement List interface in Java?
HashSet, ArrayList, Vector, or LinkedList?
HashSet
In Java, an interface can extend other interfaces using the extends keyword, T/F?
True
Java supports multiple inheritance, meaning a class can inherit from more than one base class, T/F?
False
In Java, all classes inherit from the ________ class by default.
Map, iterable, list, or object?
Object