Java currently has 50 keywords that are actually used in the language, plus 2 more words (const and goto) that are reserved but not used, making 52 reserved words in total.

How Many Keywords in Java? (Quick Scoop)

Short, direct answer

  • Number of active Java keywords: 50.
  • Extra reserved but unused words: 2 (const, goto).
  • So, Java reserves 52 words that you cannot use as identifiers (variable, method, class names, etc.).

Where the “50 vs 52” confusion comes from

Many tutorials and forums talk about “50 Java keywords” because they usually count only the words that the language actually uses in syntax (like class, if, for, int, try, catch, etc.).

However, the Java language specification and most serious references also mention const and goto: they are reserved so you cannot use them as identifiers, but they have no meaning and are not used in Java code.

So you’ll see both statements online:

“Java has 50 keywords.” – counting only usable ones.

“Java has 52 reserved words.” – counting the 50 keywords + const, goto.

Both are correct; they’re just using slightly different definitions.

Mini breakdown of the main keyword groups

You don’t need to memorize every word at once; it helps to think in families.

Some key groups:

  1. Data types
    int, float, double, char, boolean, byte, short, long – used to declare primitive data types.
  1. Control flow
    if, else, switch, case, default, for, while, do, break, continue, return – used for decisions and loops.
  1. Object-oriented and class-related
    class, interface, enum, extends, implements, this, super, new, abstract, final – define classes, inheritance, objects, and behavior.
  1. Access and packaging
    public, private, protected, static, package, import – visibility, class- level members, organizing code into packages.
  1. Exception and error handling
    try, catch, finally, throw, throws, assert – manage errors and debugging assumptions.
  1. Multithreading and low-level behavior
    synchronized, volatile, transient, native, strictfp – concurrency, serialization, native code, and numeric consistency.
  1. Special literals and utility words
    true, false, null, void, instanceof – literal values and special language constructs.

Quick HTML table: count vs category

Since you asked “how many keywords in java,” here’s a compact HTML table giving the key numbers and context:

html

<table>
  <thead>
    <tr>
      <th>Category</th>
      <th>Count / Info</th>
      <th>Examples</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Active Java keywords</td>
      <td>50</td>
      <td>class, if, for, int, try, catch, static, public, return</td>
    </tr>
    <tr>
      <td>Reserved but unused</td>
      <td>2</td>
      <td>const, goto</td>
    </tr>
    <tr>
      <td>Total reserved words</td>
      <td>52</td>
      <td>50 keywords + const + goto</td>
    </tr>
    <tr>
      <td>Common exam answer</td>
      <td>Often 50</td>
      <td>Many textbooks focus only on the actively used keywords</td>
    </tr>
  </tbody>
</table>

Today’s context (2020s Java)

Even in recent Java learning resources (2023–2025), lists still show the same 50 active keywords , and const and goto remain reserved but unused.

So if you’re answering an interview or exam:

  • Safe short answer: “Java has 50 keywords.”
  • If they like precision: “50 keywords, plus 2 reserved-but-unused (const, goto) so 52 reserved words total.”

Mini TL;DR

  • Java keywords you actually use: 50.
  • Reserved but not used: const, goto.
  • Total reserved words: 52 , and none of these can be used as variable, method, or class names.

Information gathered from public forums or data available on the internet and portrayed here.