Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

TRUE/FALSE. Write \'T\' if the statement is true and \'F\' if the statement is f

ID: 3834513 • Letter: T

Question

TRUE/FALSE. Write 'T' if the statement is true and 'F' if the statement is false.

16)

If a method in a subclass has the same signature as a method in the superclass, the subclass method overloads the superclass method.


_


17)

In an inheritance relationship, the derived class constructor always executes before the base class constructor.


_


18)

If two methods in the same class have the same name but different signatures, the second overrides the first.


_


19)

It is not possible for a superclass to call a subclass's method.


_


20)

When an interface variable references an object, you can use the interface variable to call all the methods in the class implementing the interface.


_


21)

Every class is either directly or indirectly derived from what class?


_



23)

All methods in an abstract class must also be declared abstract.


_


24)

Every class has a toString method and an equal's method inherited from the Object class.

2 2

25)) An abstract class is not instantiated, but serves as a superclass for other classes.                       

Explanation / Answer

16.

False. Correct statement is:

If a method in a subclass has the same signature as a method in the superclass, the subclass method rides the superclass method.

Example is as follows:

class Vehicle{  

void run(){System.out.println("Vehicle is running");}  

}  

class Bike2 extends Vehicle{  

void run(){System.out.println("Bike is running safely");}

public static void main(String args[]){  

Bike2 obj = new Bike2();  

obj.run();  

}

here the output will be:

Bike is running safely.

17.

False

correct statement is

first the base class default constructor is executed and then the derived class's constructor finishes execution.

Example is as follows:

class Animal{  

void eat(){System.out.println("eating...");}  

}  

class Dog extends Animal{  

void bark(){System.out.println("barking...");}  

}  

class TestInheritance{  

public static void main(String args[]){  

Dog d=new Dog();  

d.bark();  

d.eat();  

}}

18.

False

correct statement is

If two methods in the same class have the same name but different signatures, the second overloades the first.

Example is as follows:

class Adder{  

static int add(int a,int b){return a+b;}  

static int add(int a,int b,int c){return a+b+c;}  

}  

class TestOverloading1{  

public static void main(String[] args){  

System.out.println(Adder.add(11,11));  

System.out.println(Adder.add(11,11,11));  

}}

19.

False.

Correct statement is

It is possible for a superclass to call a subclass's method.