Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

51.

Define Inheritance?

Answer»

It is the process where ONE object acquires the PROPERTIES of ANOTHER. With the use of inheritance the INFORMATION is made manageable in a HIERARCHICAL order.

It is the process where one object acquires the properties of another. With the use of inheritance the information is made manageable in a hierarchical order.

52.

What Things Should Be Kept In Mind While Creating Your Own Exceptions In Java?

Answer»

While creating your own EXCEPTION

  • All exceptions must be a child of Throwable.
  • If you WANT to write a checked exception that is automatically enforced by the Handle or Declare RULE, you NEED to extend the Exception CLASS.
  • You want to write a runtime exception, you need to extend the RuntimeException class.

While creating your own exception −

53.

How Finally Used Under Exception Handling?

Answer»

The finally keyword is used to create a block of CODE that FOLLOWS a TRY block. A finally block of code always EXECUTES, whether or not an exception has OCCURRED.

The finally keyword is used to create a block of code that follows a try block. A finally block of code always executes, whether or not an exception has occurred.

54.

When Throw Keyword Is Used?

Answer»

An EXCEPTION can be THROWN, EITHER a newly instantiated ONE or an exception that you just CAUGHT, by using throw keyword.

An exception can be thrown, either a newly instantiated one or an exception that you just caught, by using throw keyword.

55.

When Throws Keyword Is Used?

Answer»

If a method does not handle a checked exception, the method must DECLARE it using the throwskeyword. The THROWS KEYWORD APPEARS at the end of a method's SIGNATURE..

If a method does not handle a checked exception, the method must declare it using the throwskeyword. The throws keyword appears at the end of a method's signature..

56.

Which Are The Two Subclasses Under Exception Class?

Answer»

The EXCEPTION CLASS has two MAIN subclasses : IOException class and RUNTIMEEXCEPTION Class

The Exception class has two main subclasses : IOException class and RuntimeException Class

57.

Give Some Features Of Interface?

Answer»
  • Interface cannot be instantiated
  • An interface does not contain any CONSTRUCTORS.
  • All of the METHODS in an interface are abstract.