Which Interface has no methods.

  1. Servlet

  2. Runnable

  3. Serializable

  4. ActionListener


Correct Option: C

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) Servlet - This option is incorrect. The Servlet interface in Java has several methods, such as init(), service(), and destroy(), which are used to handle HTTP requests and responses.

Option B) Runnable - This option is incorrect. The Runnable interface in Java has a single method called run(), which is used to define the code that will be executed in a separate thread.

Option C) Serializable - This option is correct. The Serializable interface in Java is a marker interface, which means it does not have any methods defined in it. It is used to indicate that a class can be serialized, i.e., its objects can be converted into a stream of bytes for storage or transmission.

Option D) ActionListener - This option is incorrect. The ActionListener interface in Java has a single method called actionPerformed(), which is used to handle action events, such as button clicks or menu selections.

The correct answer is C) Serializable. This option is correct because the Serializable interface does not have any methods defined in it.

Find more quizzes: