In Java, which of the following statements is/are True ?
S1 : The ‘final’ keyword applied to a class definition prevents the class from 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.
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: A. S1 and S2 only
Explanation
A final class can't be extended (S1), and Java has single class inheritance with multiple interfaces (S2). Replacing an inherited method is overriding, not overloading, so S3 is false.
More Programming Languages and Computer Graphics questions
- Which of the following statements is/are True ? P : C programming language has a weak type system with static types. Q : Java programming l…
- A graphic display system has a frame buffer that is 640 pixels wide, 480 pixels high and 1 bit of color depth. If the access time for each…
- Which of the following statements is/are True regarding the solution to the visibility problem in 3D graphics ? S1 : The Painter’s algorith…
- Consider the matrix M = [2 0 2; 0 1 1; 0 0 1] representing a set of planar (2D) geometric transformations in homogeneous coordinates. Which…
- Given below are three implementations of swap() in C++: (a) void swap(int a, int b) { int temp; temp = a; a = b; b = temp; } called as swap…
- What is the output of the following C program? (Assume little-endian representation, with the least significant byte at the lowest address,…