Classes don't have keyword "new" as a personal method or anything like that. It is the Java language itself that has the keyword "new". So in other words you put "new" in the code the compiler would recognize it and instantiate a new Object.

http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.9- this link is the documentation of Java language, in section 3.9 it shows all the keywords.

Edit: Like others are saying, what the snippet of code in your question indicates an inner class, so for instance, like it says in http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html

public class ShadowTest {

public int x = 0;

class FirstLevel {

    public int x = 1;

    void methodInFirstLevel(int x) {
        System.out.println("x = " + x);
        System.out.println("this.x = " + this.x);
        System.out.println("ShadowTest.this.x = " + ShadowTest.this.x);
    }
}

public static void main(String... args) {
    ShadowTest st = new ShadowTest();
    ShadowTest.FirstLevel fl = st.new FirstLevel();
    fl.methodInFirstLevel(23);
}
}

The following is the output of this example:

x = 23
this.x = 1
ShadowTest.this.x = 0

This shows that the innerclass or class B(FirstLevel) is like or similar to the outer class's variables and methods(for it is associated with the instance of the outer class) of class A(ShadowTest).

Answer from Rika on Stack Overflow
🌐
Oracle
docs.oracle.com › javase › tutorial › java › nutsandbolts › _keywords.html
Java Language Keywords (The Java™ Tutorials > Learning the Java Language > Language Basics)
You cannot use any of the following as identifiers in your programs. The keywords const and goto are reserved, even though they are not currently used. true, false, and null might seem like keywords, but they are actually literals; you cannot use them as identifiers in your programs.
🌐
W3Schools
w3schools.com › java › java_ref_keywords.asp
Java Keywords
Access Modifiers Non-Access Modifiers Java Encapsulation Java Packages / API Java Inheritance Java Polymorphism Java super Keyword Java Inner Classes Java Abstraction Java Interface Java Anonymous Java Enum
🌐
GeeksforGeeks
geeksforgeeks.org › java › java-keywords
Java Keywords - GeeksforGeeks
August 27, 2018 - In Java, keywords are the reserved words that have some predefined meanings and are used by the Java compiler for some internal process or represent some predefined actions.
🌐
Wikipedia
en.wikipedia.org › wiki › List_of_Java_keywords
List of Java keywords - Wikipedia
October 20, 2025 - In the Java programming language, a keyword is any one of 68 reserved words that have a predefined meaning in the language. Because of this, programmers cannot use keywords in some contexts, such as names for variables, methods, classes, or ...
🌐
DataCamp
datacamp.com › doc › java › category › keywords
Java Keywords
In Java, keywords are reserved words that have a predefined meaning in the language. They form the foundation of Java's syntax and cannot be used as identifiers, such as variable names, method names, or class names.
🌐
Igmguru
igmguru.com › blog › java-keywords
Java Keywords – 68 Java Keywords Explained
4 weeks ago - Java Keywords are 68 reserved words that have predefined meanings and cannot be used for variables, methods, or identifiers. Learn them all with this comprehensive guide.
Top answer
1 of 3
2

Classes don't have keyword "new" as a personal method or anything like that. It is the Java language itself that has the keyword "new". So in other words you put "new" in the code the compiler would recognize it and instantiate a new Object.

http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.9- this link is the documentation of Java language, in section 3.9 it shows all the keywords.

Edit: Like others are saying, what the snippet of code in your question indicates an inner class, so for instance, like it says in http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html

public class ShadowTest {

public int x = 0;

class FirstLevel {

    public int x = 1;

    void methodInFirstLevel(int x) {
        System.out.println("x = " + x);
        System.out.println("this.x = " + this.x);
        System.out.println("ShadowTest.this.x = " + ShadowTest.this.x);
    }
}

public static void main(String... args) {
    ShadowTest st = new ShadowTest();
    ShadowTest.FirstLevel fl = st.new FirstLevel();
    fl.methodInFirstLevel(23);
}
}

The following is the output of this example:

x = 23
this.x = 1
ShadowTest.this.x = 0

This shows that the innerclass or class B(FirstLevel) is like or similar to the outer class's variables and methods(for it is associated with the instance of the outer class) of class A(ShadowTest).

2 of 3
0

As all the languages ,Java has Keywords. Here the new keyword is used for initialization purposes.here the object of the class A is initialised in the first statement. in second statement the object of class B is initialised with class A's object A

🌐
Programiz
programiz.com › java-programming › keywords-identifiers
Java Keywords and Identifiers
Become a certified Java programmer. Try Programiz PRO! ... Keywords are predefined, reserved words used in Java programming that have special meanings to the compiler.
Find elsewhere
🌐
Unstop
unstop.com › home › blog › java keywords explained | list of 54 keywords +code examples
Java Keywords Explained | List Of 54 Keywords +Code Examples // Unstop
December 12, 2024 - Keywords in Java are reserved words with predefined meaning and functionality that cannot be used for anything else. Examples: class, int, if, for, while, etc.
🌐
CodeJava
codejava.net › java-core › the-java-language › java-keywords
Summary of all Java keywords with code examples
Java keywords for access modifiers: private, protected, publicJava keywords for class, method, variable modifiers:abstract, class, default, extends, final, implements, interface, native, new, static, strictfp, synchronized, transient, var, record, volatile Java keywords for Flow control:break, case, continue, default, do, else, for, if, instanceof, return, switch, while,yield Java keywords for package control: import, package Java keywords for primitive types: boolean, byte, char, double, float, int, long, short Java keyword for error handling: assert, catch, finally, throw, throws, try Java keyword for enumeration: enumOther Java keywords: super, this, voidUnused (reserved) Java keywords: const, goto
🌐
Javatpoint
javatpoint.com › java-keywords
Java Keywords - Javatpoint
Java Keywords with java tutorial, features, history, variables, object, class, programs, operators, swith, for-loop, oops concept, inheritance, array, string, map, math, methods, examples etc.
🌐
DataFlair
data-flair.training › blogs › java-keywords
Java Keywords - List of 51 Keywords with Examples - DataFlair
May 12, 2024 - 10. continue: Continue is also a jump statement in java. Using it we can terminate the current iteration and continue from the next iteration inside the loop. ... 11. default: default is the keyword using which we can declare the default statement inside a switch case.
🌐
Oracle
docs.oracle.com › cd › E13226_01 › workshop › docs81 › pdf › files › workshop › JavaKeywordReference.pdf pdf
Java Language Keywords
boolean Java Keyword.......................................................................................................................................4
🌐
University of North Carolina
cs.unc.edu › ~weiss › COMP14 › 18-JavaKeyWords.html
Java Keywords or Reserved Words (52)for jdk1.4
Keywords for catch-exception are: try catch finally throw · Keywords for loops or decision-makers are: break case continue default do while for switch if else · Keywords for class functions are: class extends implements import instanceof new package return interface this throws void super ·
🌐
Great Learning
mygreatlearning.com › blog › it/software development › java keywords
Master Java Keywords: A Detailed List with Examples
June 27, 2025 - Leverage OOP Keywords: Use class, extends, implements, abstract, and interface to design robust object-oriented systems. This promotes code reusability and maintainability. To test the understanding more better, take Java Quiz.
🌐
SMU
cs.smu.ca › ~porter › csc › 465 › notes › javapl_keywords.html
Java Keywords
These keywords, like const and goto, are not currently part of the language, but are "reserved for future use": byvalue cast future generic inner operator outer rest var volatile · The reserved word assert is new as of Java 1.4.
🌐
Upgrad
upgrad.com › home › blog › software development › a complete guide to java keywords
A Guide to Java Keywords: What You Need to Know!
August 7, 2025 - Other Important Keywords: Such as static, final, abstract, synchronized, and volatile modify how your classes, methods, and variables behave. ... Java has recently added some new Java language keywords for its development.
🌐
Medium
medium.com › @TechiesSpot › java-keywords-an-in-depth-guide-19f1504b3686
Java Keywords: An In-Depth Guide. In the world of Java programming… | by Techie's Spot | Medium
January 22, 2024 - In the world of Java programming, keywords are the building blocks of the language. These reserved words have specific meanings and are…
🌐
Java Concept Of The Day
javaconceptoftheday.com › home › java keywords cheat sheet
Java Keywords Cheat Sheet
September 8, 2022 - Java keywords are the reserved words which have predefined meaning in the language and hence can’t be used as identifiers. There are 67 Java keywords as of now. In this post, I have created a Java keywords cheat sheet.
🌐
TechVidvan
techvidvan.com › tutorials › keywords-in-java
Keywords in Java - Java Reserved Words - TechVidvan
June 5, 2020 - Java Keywords - What are keywords in java and list of java keywords with examples - boolean, short, for, case, catch,final,interface,protected, this, byte