Science, Tech, Math › Computer Science Reserved Words in Java Here's the full list of words you cannot use in Java Share Flipboard Email Print Thomas Barwick/Stone/Getty Images Computer Science Java Programming PHP Programming Perl Python Javascript Programming Delphi Programming C & C++ Programming Ruby Programming Visual Basic View More By Paul Leahy Paul Leahy Computer Science Expert M.A., Advanced Information Systems, University of Glasgow Paul Leahy is a computer programmer with over a decade of experience working in the IT industry, as both an in-house and vendor-based developer. Learn about our Editorial Process Updated on January 27, 2019 Reserved words are words that cannot be used as object or variable names in a Java program because they're already used by the syntax of the Java programming language. If you ttempt to use any of the words below as identifiers in your Java programs, you'll get an error like the one below. List of Reserved Java Keywords abstract assert boolean break byte case catch char class const continue default double do else enum extends false final finally float for goto if implements import instanceof int interface long native new null package private protected public return short static strictfp super switch synchronized this throw throws transient true try void volatile while *The strictfp keyword was added to this list in Java Standard Edition version 1.2, assert in version 1.4, and enum in version 5.0. Even though goto and const are no longer used in the Java programming language, they still cannot be used as keywords. What Happens If You Use a Reserved Word? Let's say you try to create a new class and name it using a reserved word, like this: // you can't use finally as it's a reserved word! class finally { public static void main(String[] args) { //class code.. } } Instead of compiling, the Java program will instead give the following error: expected Cite this Article Format mla apa chicago Your Citation Leahy, Paul. "Reserved Words in Java." ThoughtCo, Aug. 26, 2020, thoughtco.com/reserved-words-in-java-2034200. Leahy, Paul. (2020, August 26). Reserved Words in Java. Retrieved from https://www.thoughtco.com/reserved-words-in-java-2034200 Leahy, Paul. "Reserved Words in Java." ThoughtCo. https://www.thoughtco.com/reserved-words-in-java-2034200 (accessed June 7, 2023). copy citation By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. Cookies Settings Accept All Cookies