Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Java OOPs Interview Questions and Answers

Ques 21. What is the 'this()' constructor call in Java?

The 'this()' constructor call is used to invoke another constructor in the same class. It must be the first statement in the constructor if used.

Example:

class MyClass { MyClass(int x) { this(); /* other constructor code */ } 
MyClass() { /* default constructor code */ } }

Is it helpful? Add Comment View Comments
 

Ques 22. Explain the concept of method hiding in Java.

Method hiding occurs when a subclass provides a static method with the same signature as a static method in its superclass. It does not override the superclass method.

Example:

class Parent { static void display() { /* method implementation */ } }
class Child extends Parent { static void display() { /* hiding method implementation */ } }

Is it helpful? Add Comment View Comments
 

Ques 23. What is a singleton class in Java?

A singleton class in Java is a class that allows only one instance to be created. It provides a global point of access to that instance.

Example:

class Singleton { private static Singleton instance = new Singleton(); 
private Singleton() {} 
public static Singleton getInstance() { return instance; } }

Is it helpful? Add Comment View Comments
 

Ques 24. Explain the concept of abstract method in Java.

An abstract method is a method declared without an implementation in an abstract class. Subclasses must provide the implementation for abstract methods.

Example:

abstract class Shape { abstract void draw(); }

Is it helpful? Add Comment View Comments
 

Ques 25. What is the 'throws' clause in Java?

The 'throws' clause in Java is used to declare exceptions that a method might throw. It indicates that the method does not handle the exceptions and passes them to its caller.

Example:

void myMethod() throws IOException { /* method code */ }

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

©2025 WithoutBook