The Gateway to Computer Science Excellence
0 votes
327 views

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
in Object Oriented Programming by Boss (10.9k points)
recategorized by | 327 views
+1

only s1 and s2

correct statement for s3 is :

 Java permits a class to replace the implementation of a method that it has inherited. It is called method over riding

3 Answers

0 votes
All Statements are True.

Option(4) All S1,S2 and S3.
by Junior (859 points)
0 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.

 

by (337 points)
0 votes
S1 & S2 are true

S3 is false because that is overriding
by (217 points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,291 answers
198,209 comments
104,890 users