Java - Online Test - Inheritence -


Search Java Test Questions

 223 test questions in repository.

Java - Test Questions on 'Inheritence' - 5 questions found

Which of the following is false about Constructors ?
Constructor can be overloaded
A no argument constructor is provided by the compiler if we declare only constructors with arguments.
Constructors shouldn't have any return types , not even void.
If super is not explicitly called, still super() is intrinsically added by the compiler.

  java  oops  constructor

Overridden methods must have the same ... Core Java
name and argument list
name, argument list, and return type
name, argument list, return type and belong to the same class

  java  overriding

Which of the following can be overridden ?Core Java
final instance methods
final static methods
non final instance methods
non final static methods


What is the problem with this code ?

public class Car extends Vehicle{   
   int x;
   Car(int y){
      x = 5;
Core Java
We cannot overload constructors
Constructors should have type
we should have called super() before this(5)
We cannot have both super() and this() in a constructor

  Constructor  this  super

Which of the following is not true ?Core Java
A Java class can extend multiple classes
A Java class can implement multiple interfaces
A Java interface can extend multiple interfaces
All of above are true

  inheritance  multiple inheritance

comments powered by Disqus