Keywords in Java

⏱️ 5 min read • Beginner Level • Lesson 9

Lesson 9 of 124 of Java Tutorial
You have completed this lesson

Completed on . You can revise this lesson or continue to the next topic.

Java keywords are reserved words that have predefined meanings in the Java language. These words are part of Java syntax and cannot be used as variable names, method names, or class names.


Key Points

Important Facts About Java Keywords
  • Keywords are special reserved words.
  • They have predefined meanings in Java.
  • Keywords cannot be used as identifiers.

Java Language Keywords

abstract continue for new
switch assert default goto
package synchronized boolean do
if private this break
double implements protected throw
byte else import public
throws case enum instanceof
return transient catch extends
int short try char
final interface static void
class finally long strictfp
volatile const float native
super while

Reserved Keywords

Reserved Keywords (Not in Use)

const goto (Reserved but not implemented)


Added in Java Versions:

  • Java 1.2 → strictfp
  • Java 1.4 → assert
  • Java 1.5 → enum

Example Using Java Keywords

The following program uses keywords such as public, class, static, and void.

Demo.java
Copy Try Download
public class Demo {
    public static void main(String[] args) {
        System.out.println("Java Keywords Example");
    }
}
Explanation: The keywords public, class, static, and void are predefined words recognized by the Java compiler.
Summary:
  • Keywords are predefined reserved words in Java.
  • They cannot be used as identifiers.
  • They define syntax and structure of Java programs.

Interview Questions ⭐

Java keywords are reserved words with predefined meanings used by the Java compiler.

No, Java keywords cannot be used as identifiers such as variable or class names.

Java has around 50+ reserved keywords used in the language.

Next step: Learn Java Variables

🚀 Continue to Java Variables →

🧠 Test your understanding with a quick quiz



🚀 Quick Knowledge Check

Topic: Keywords | Language: Java

Question 1 of 9
Q1. Which of the following is a reserved keyword but not used in Java?
Q2. Which of the following can keywords NOT be used as?
Q3. What does the 'strictfp' keyword ensure?
Q4. Which keyword was added in Java 1.5?
Q5. Which of the following is TRUE about the keyword 'const' in Java?
Q6. Which keyword was added in Java 1.2?
Q7. What are Java keywords?
Q8. Which keyword was added in Java 1.4?
Q9. Which of the following keywords is reserved in Java but never implemented?

🎉 Great job! Continue learning Java.

Discussion

Ask questions, share suggestions, or discuss this lesson.

Please login or create an account to join the discussion and save your learning activity.

Loading comments...

Have you completed this lesson?

Mark this lesson as completed to track your learning progress. To keep track across devices, please login and save your learning progress.

Not completed yet.