Home
Java
Keywords
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.
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.
🧠 Test your understanding with a quick quiz
🚀 Quick Knowledge Check
Topic: Keywords |
Language: Java
← Previous
Question 1 of 9
🔄 Restart
Next →
Q1. Which of the following is a reserved keyword but not used in Java? enum assert const strictfp
Q2. Which of the following can keywords NOT be used as? Variables Class names All of the above Methods
Q3. What does the 'strictfp' keyword ensure? Memory cleanup of objects Secure file processing Synchronization of threads Strict floating-point calculations for portability
Q4. Which keyword was added in Java 1.5? strictfp const enum assert
Q5. Which of the following is TRUE about the keyword 'const' in Java? It is fully functional and replaces 'final' It is the same as 'static' It is used for defining constants It is reserved but never implemented
Q6. Which keyword was added in Java 1.2? assert strictfp volatile enum
Q7. What are Java keywords? Libraries for Java execution Special reserved words with predefined meanings in the Java compiler User-defined identifiers Methods used in Java classes
Q8. Which keyword was added in Java 1.4? enum assert strictfp goto
Q9. Which of the following keywords is reserved in Java but never implemented? interface switch package goto
🎉 Great job! Continue learning Java.
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.
✅ Mark as Completed
↩ Mark as Incomplete
Not completed yet.
Discussion
Ask questions, share suggestions, or discuss this lesson.