Common Java Keywords

ad space

In computer programming, a keyword is a word or an identifier that has a particular meaning to the particular programming language it is being used.

In Java, just like in other types of programming language, keywords are those reserved words that are used in control flow constructs and cannot be used as names for variables or functions. Java keywords have a fixed meaning used to provide syntactic form that makes the whole Java language work out fine.

Here are some of the most important Java keywords:

break

This is a keyword used to resume program execution of a statement following a current enclosed block or statement. If it is followed by a label, the program resumes the execution at the statement that is immediately following the enclosed labeled block or statement.

case

This keyword is used to define a group of statements to execute if the specified value matches the value that is defined by the enclosing switch statement.

continue

This is used to resume program execution at the end of a loop body. If it is followed by a label, the keyword "continue" resumes the execution of the statement at the end of the enclosing labeled loop body.

if

This keyword is used to perform a conditional test and execute a block of statements if the said test is evaluated as true. If there is an optional block that is defined with the "else" keyword, then the optional block is executed if the test is evaluated as false.

else

This keyword is used to define a statement or a block of statements executed in a conditional test that is evaluated as false in the statement specified by the "if" keyword.

default

This keyword is used to define a group of statements that begin executing if the value that is defined by the enclosing "switch" statement does not match any of the value specified by the "case" keyword in the "switch" statement.

switch

This keyword is used to evaluate a variable that can be matched later on with a specified value in the "case" statement in order to execute another group of statements.