Keyword In Java Program



Programming Python Reference Java Reference. Java Reserved Keywords. Java has a set of keywords that are reserved words that cannot be used as variables, methods. Super keyword in java is a reference variable that is used to refer parent class object. Super is an implicit keyword create by JVM and supply each and every java program for performing important role in three places. Super keyword At Variable Level Super keyword At Method Level. With Java 8, we can add the default implementation for the new method by using the default keyword before the method implementation. Even with anonymous classes or functional interfaces, if we see that some code is reusable and we don’t want to define the same logic everywhere in the code, we can write default implementations of those.

Related articles:

This Keyword In Java Program

Java
Load more
Base

The Java programming language has 50 keywords. Each keyword has a specific meaning in the language. You can’t use a keyword for anything other than its pre-assigned meaning.

The following table lists Java’s keywords.

KeywordWhat It Does
abstractIndicates that the details of a class, a method, or an interface are given elsewhere in the code.
assertTests the truth of a condition that the programmer believes is true.
booleanIndicates that a value is either true or false.
breakJumps out of a loop or switch.
byteIndicates that a value is an 8-bit whole number.
caseIntroduces one of several possible paths of execution in a switch statement.
catchIntroduces statements that are executed when something interrupts the flow of execution in a try clause.
charIndicates that a value is a character (a single letter, digit, punctuation symbol, and so on) stored in 16 bits of memory.
classIntroduces a class — a blueprint for an object.
constYou can’t use this word in a Java program. The word has no meaning but, because it’s a keyword, you can’t create a variable named const.
continueForces the abrupt end of the current loop iteration and begins another iteration.
defaultIntroduces a path of execution to take when no case is a match in a switch statement.
doCauses the computer to repeat some statements over and over again (for instance, as long as the computer keeps getting unacceptable results).
doubleIndicates that a value is a 64-bit number with one or more digits after the decimal point.
elseIntroduces statements that are executed when the condition in an if statement isn’t true.
enumCreates a newly defined type — a group of values that a variable can have.
extendsCreates a subclass — a class that reuses functionality from a previously defined class.
finalIndicates that a variable’s value cannot be changed, that a class’s functionality cannot be extended, or that a method cannot be overridden.
finallyIntroduces the last will and testament of the statements in a try clause.
floatIndicates that a value is a 32-bit number with one or more digits after the decimal point.
forGets the computer to repeat some statements over and over again (for instance, a certain number of times).
gotoYou can’t use this word in a Java program. The word has no meaning. Because it’s a keyword, you can’t create a variable named goto.
ifTests to see whether a condition is true. If it’s true, the computer executes certain statements; otherwise, the computer executes other statements.
implementsIndicates that a class provides bodies for methods whose headers are declared in an interface.
importEnables the programmer to abbreviate the names of classes defined in a package.
instanceofTests to see whether a certain object comes from a certain class.
intIndicates that a value is a 32-bit whole number.
interfaceIntroduces an interface. An interface is like a class but, for the most part, an interface’s methods have no bodies.
longIndicates that a value is a 64-bit whole number.
nativeEnables the programmer to use code that was written in a language other than Java.
newCreates an object from an existing class.
packagePuts the code into a package — a collection of logically related definitions.
privateIndicates that a variable or method can be used only within a certain class.
protectedIndicates that a variable or method can be used in subclasses from another package.
publicIndicates that a variable, class, or method can be used by any other Java code.
returnEnds execution of a method and possibly returns a value to the calling code.
shortIndicates that a value is a 16-bit whole number.
staticIndicates that a variable or method belongs to a class, rather than to any object created from the class.
strictfpLimits the computer’s ability to represent extra large or extra small numbers when the computer does intermediate calculations on float and double values.
superRefers to the superclass of the code in which the word super appears.
switchTells the computer to follow one of many possible paths of execution (one of many possible cases), depending on the value of an expression.
synchronizedKeeps two threads from interfering with one another.
thisA self-reference — refers to the object in which the word this appears.
throwCreates a new exception object and indicates that an exceptional situation (usually something unwanted) has occurred.
throwsIndicates that a method or constructor may pass the buck when an exception is thrown.
transientIndicates that, if and when an object is serialized, a variable’s value doesn’t need to be stored.
tryIntroduces statements that are watched (during runtime) for things that can go wrong.
voidIndicates that a method doesn’t return a value.
volatileImposes strict rules on the use of a variable by more than one thread at a time.
whileRepeats some statements over and over again (as long as a condition is still true).

Throw Keyword In Java Program

Java

Keywords are words that have already been defined for Java compiler. They have special meaning for the compiler. Java Keywords must be in your information because you can not use them as a variable, class or a method name.

Java Reserved Keywords List

Java using keyword

You can't use keyword as identifier in your Java programs, its reserved words in Java library and used to perform an internal operation.

Java keyword list
abstractassertbooleanbreak
bytecasecatchchar
classconstcontinuedefault
dodoubleelseenum
extendsfinalfinallyfloat
forgotoifimplements
importinstanceofintinterface
longnativenewpackage
privateprotectedpublicreturn
shortstaticstrictfpsuper
switchsynchronizedthisthrow
throwstransienttryvoid
volatilewhiletruefalse
null

Keywords In Java Programming

true, false and null are not reserved words but cannot be used as identifiers, because it is literals of built-in types.