search
Log In
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
0 votes
642 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
recategorized by
642 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

1 vote

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.

 

0 votes
All Statements are True.

Option(4) All S1,S2 and S3.
0 votes
S1 & S2 are true

S3 is false because that is overriding

Related questions

1 vote
3 answers
1
2k views
Given below are three implementations of the swap() function in C++: a b c void swap (int a, int b) { int temp; temp=a; a=b; b=temp; } int main() { int p=0, q=1; swap(p, q); } void swap (int &a, int &b) { int temp; temp=a; a=b; b=temp; } int ... Which of these would actually swap the contents of the two integer variables p and q? a only b only c only b and c only
asked Jul 13, 2018 in Object Oriented Programming Pooja Khatri 2k views
1 vote
3 answers
2
1.4k views
What is the output of the following JAVA program? class simple { public static void main(String[ ] args) { simple obj = new simple(); obj.start(); } void start() { long [] P = {3, 4, 5}; long [] Q = method (P); System.out.print (P[0] + P[1] +P[2]+”:”); System.out.print (Q[0] + Q[1] + Q[2]); } long [ ] method (long [ ] R) { R[1] = 7; return R; } } //end of class 12:15 15:12 12:12 15:15
asked Jul 13, 2018 in Java Pooja Khatri 1.4k views
0 votes
1 answer
3
740 views
Which of the following statements is/are true? P: C programming language has a weak type system with static types. Q: Java programming language has a string type system with static types Code: P only Q only Both P and Q Neither P nor Q
asked Jul 13, 2018 in Programming Pooja Khatri 740 views
0 votes
1 answer
4
101 views
Given the array of integers ‘array’ shown below: $\begin{array}{|c|c|c|c|c|c|c|c|c|c|} \hline 13 & 7 & 27 & 2 & 18 & 33 & 9 & 11 & 22 & 8 \\ \end{array}$ What is the output of the following JAVA statements? int[]p= new int [10]; int[]q= new int [10]; for ( int k=0; k<10; k++) p[k]= array [k]; q=p; p[4]=20; System.out.println(array[4]+":"+q[4]); $20:20$ $18:18$ $18:20$ $20:18$
asked Mar 24 in Object Oriented Programming jothee 101 views
...