Question: 21-Given the following code snippet: for(Circle c:circles) { System.out.println(c.toString()); } Select one: a. The compiler will report an error if the toString( ) method is

21-Given the following code snippet:

for(Circle c:circles)

{

System.out.println(c.toString());

}

Select one:

a. The compiler will report an error if the toString( ) method is not defined in the Circle class

b. All of these

c. The compiler will report an error if the toString( ) method is not overridden in the Circle class

d. The compiler will call the toString( ) method of the parent class of class Circle if it is not defined in the Circle class

22-In the following code:

public interface Lambdas extends Shape{

void print();

void printOdds(int n);

}

Select one:

a. Both Lambdas and Shape are interfaces

b. None of these

c. Lambdas is and interface but Shape is a class

d. Both Lambdas and Shape are classes

23-Java allows extending multiple classes through a single class declaration statement such as:

public class Student extends Person, Human {

//code goes here

} Select one: True False

24-Overloaded methods are differentiated by:

Select one:

a. Number of arguments

b. Data type of arguments

c. Number and the Data type of the arguments

d. None of the these

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!