recategorized by
3,599 views
0 votes
0 votes

In Java, which of the following statements is/are TRUE?

S1: The ‘final’ keyword applied to a class definition prevents the class form being extended through derivation

S2: A class can only inherit one class but can implement multiple interfaces

S3: Java permits a class to replace the implementation of a method that it has inherited. It is called method overloading

Code:

  1. S1 and S2 only
  2. S1 and S3 only
  3. S2 and S3 only
  4. All of S1, S2 and S3
recategorized by

3 Answers

1 votes
1 votes

answer is S1 and S2 only.

the final keyword applied to class- prevent it from extending.
the final keyword applied to method- prevent it from overriding
the final keyword applied to variable- prevent it from changing the value.
 

class inherits(or extends only one class) and extends(or implements ) multiple interfaces.

replacement of method implementation is known as method overriding. its not method overloading. over loading is done by changing the no of argument which it is passed, or changing the datatype of arguments.

 

Related questions

1 votes
1 votes
6 answers
1
Pooja Khatri asked Jul 13, 2018
4,598 views
Given below are three implementations of the $\text{swap()}$ function in $\text{C++}$ :$\begin{array}{|l|l|l|} \hline \qquad \qquad \text{(a)} & \qquad \qquad \text{(b)}...
0 votes
0 votes
1 answer
3