Which of the following is not a java keyword?

  1. assert

  2. interface

  3. extend

  4. transient


Correct Option: C

AI Explanation

To answer this question, we need to understand the concept of Java keywords.

Java keywords are reserved words that have specific meanings and purposes in the Java programming language. These keywords cannot be used as identifiers (such as variable names, class names, or method names) because they are already predefined in the language.

Let's go through each option to understand why it is correct or incorrect:

Option A) assert - This option is incorrect because "assert" is a Java keyword used for assertions in the code.

Option B) interface - This option is incorrect because "interface" is a Java keyword used to define an interface, which is a collection of abstract methods.

Option C) extend - This option is correct because "extend" is not a Java keyword. "extend" is used in Java to create a subclass and inherit properties and methods from a superclass, but it is not a reserved keyword.

Option D) transient - This option is incorrect because "transient" is a Java keyword used to indicate that a variable should not be serialized during object serialization.

The correct answer is Option C) extend. This option is correct because "extend" is not a Java keyword.

Find more quizzes: