Java Language Keywords
Java is a type of programming language, which aims to control the behavior of a machine, particularly a computer. Like natural language, programming language are defined by syntax and semantics describing their structure and meaning respectively.
Programming languages are used to facilitate communication about the task of organizing and manipulating information, as well as expressing algorithms precisely.
Like most programming languages, Java follows a list of keywords, much like a language's dictionary. Most applications highlights these keywords to display them in different colors for easy identification. Please do note that the keywords "const" and "goto" are reserved, even though they are not currently used.
Meanwhile, "true," "false," and "null" might seem like keywords, but they are actually literals, which cannot be used as identifiers in a program.
abstract - This is used in a class declaration to specify that a class is not to be instantiated. Instead, it should be extended by other classes. "abstract" is used in a method declaration without providing the implementation. An abstract class can have methods that are implemented in subclasses.
assert - Used to make the assumed value of a condition explicit. This keyword is applicable as of version 1.4.
boolean - This refers to an expression or variable that can have only a true or false value. The Java language provides the "boolean" type and the literal values "true" and "false."
break - This is used to resume a program execution at the statement immediately following the current enclosing block or statement. If this is followed by a label, the program resumes execution at the statement immediately following the enclosing labeled statement or block.
byte - An 8-bit integer used to declare an expression, method of return value, or variable of type byte.
case - This keyword defines a group of statements to execute if the specified value matches the value defined by the enclosing "switch" statement.
catch - Used as an "exception handler," a group of statements that are executed if an exception is thrown in the block defined by a preceding "try" keyword. It is executed only if the class of the thrown exception is assignment-compatible with the exception class declared by the "catch" clause.
char - A 16-bit Unicode character used to declare an expression, method return value, or variable of type character.
class - This defines the implementation of a particular kind of object as well as "instance" and "class" fields, methods, and inner classes. This also works as a specifier of the "interfaces" the class implements and the immediate superclass of the class. If the superclass is not explicitly specified, that is implicitly defined as an "object."
const - A reserved word no longer used in current versions of Java. It was used as a variable whose value cannot be changed once it is initially bound to a value.
continue - Used to resume program execution at the end of the current loop body. If this keyword is followed by a label, "continue" resumes execution at the end of the enclosing labeled loop body.
default - This defines a group of statements that would be executed if the value defined by the enclosing "switch" statement does not match any value specified by a "case" keyword in the switch statement.
do - Used to declare a loop that would repeat a block of statements. That loop would end if it is specified with the "while" keyword. The loop would be executed once before evaluating the exit condition.
double - A 64-bit floating point value, which represents a real number. This is used to declare an expression, method return value, or variable of type double-precision floating point number.
else - Used to define a statement or block of statements that are executed in case that the test condition specified by the "if" keyword evaluates to "false".
enum - Used to declare an enumerated type, which is an abstract data type used to model an attribute that has a specific number of options such as the suit of a playing card. This allows the program to handle the attribute more efficiently than a string while maintaining the readability of the source code. This keyword has been of use as of version 5.0.
extends - Used in a class declaration to specify superclasses or superinterfaces. For instance, Class X extends to class Y to add functionality, either by adding fields or methods to class Y, or by overriding methods of class Y.
final - Defines an entity that cannot be changed nor derived from later. A final class cannot be subclassed, a final method cannot be overridden, and a final variable can only occur once as a left-hand expression.
finally - Defines a block of statements for another block previously defined by the "try" keyword. The "finally" block is executed after the said execution exits the "try" block and any associated "catch" clauses, regardless of whether an exception was thrown or caught, or execution left method in the middle of the "try" or "catch" block using the "return" keyword.
float - A 32-bit floating point value used to declare an expression, method return value, or variable of single-precision floating point number.
for - Defines a loop that reiterates statements. The "for" loop specifies the statements to be executed, exit condition, and initialization variables for the loop. The exit condition is evaluated before the first iteration of the loop. Since version 5.0, a form of the "for" loop specifies an "iterable" object where each iteration of the loop processes one of its contained elements.
goto - A reserved keyword not used in current versions of the Java programming language.
if - Conducts a conditional test and executes a block of statements if the test evaluates to "true". If an optional block is defined with the "else" keyword, then the "else" block is executed if the test evaluates to "false".
implements - Part of a class declaration that specifies one or more interfaces that are implemented by the current class. A class inherits the types and abstract methods declared by the interfaces.
import - Used at the beginning of a source code, which is any sequence of statements or declarations, to specify classes or entire Java packages to be referred to later without their package names in the reference. Since version 5.0, "import" statements can import "static" members of a class.
instanceof - A binary operator that takes an object reference as its first "operand" and a class or interface as its second operand and produces a "boolean" result. The "instanceof" operator evaluates to "true" if and only if the runtime type of the object is assignment-compatible with the class or interface.
int - A 32-bit interger value used to declare an expression, method return value, or variable of type integer.
interface - Declares a special type of class that only contains abstract methods, constant ("static final") fields and "static" interfaces. It can later be implemented by classes that declare the interface with the "implements" keyword.
long - A 64-bit integer value used to declare an expression, method return value, or variable of a long integer.
native - Used in method declarations to specify that the method is not implemented in the same Java source file, but rather in another programming language.
new - Creates an instance of a class or array.
package - A group of types.
private - An access modifier used in a method, field, or inner class declaration, signifying that the member can only be accessed by other elements of its class.
protected - An access modifier signifying that the member can only be accessed by elements residing in its class, subclasses, or classes in the same package.
public - An access modifier signifying that the class, method, or variable can be accessed by elements residing in other classes or packages. All members declared in an "interface" are implicitly "public".
return - Finishes the execution of a method. It can be followed by a value required by the method definition that is returned to the caller.
short - A 16-bit integer value used to declare an expression, method return value, or variable of any short integer.
static - Declares a field, method, or inner class as a class field. Classes maintain one copy of class fields regardless of how many instances exist of that class. "Static" also defines a method as a class method that are bound to the class instead of to a specific instance, and can only operate on class fields.
strictfp - Restricts the precision and rounding of floating point calculations to ensure portability. Usable as of version 1.2.
super - Accesses members of a class inherited by the class in which it appears. Allows a subclass to access overridden methods and hidden numbers of its superclass. The "super" keyword is also used to forward a call from a constructor to another constructor in the superclass.
switch - Evaluates a variable that can later be matched with a value specified by the "case" keyword in order to execute a group of statements.
synchronized - Used in the declaration of a method or code block to acquire the mutual exclusion lock, which avoids the simultaneous use of a common resource, for an object while the current thread-which makes the program split itself into two or more simultaneous running tasks-executes the code. For static methods, the object locked is the "class". The mutex lock is automatically released when execution exits the synchronized code.
this - Represents an instance of the class in which it appears. Can be used to access class members and as a reference to the current instance, as well as forwarding a call from one constructor in a class to another constructor within the same class.
throw - Causes the declared exception instance to be thrown. This causes execution to continue with the first enclosing exception handler declared by the "catch" keyword to handle an assignment-compatible exception type. If no such exception handler is found in the current method, the method returns and the process is repeated in the calling method. If no exception handler is found in any method call on the stack, then the exception is passed to the thread's uncaught exception handler.
throws - Used in method declarations to specify which exceptions are not handled within the method but rather passed to the next higher level of the program. All uncaught exceptions in a method that are not instances of "runtimeexception" must be declared using the "throws" keyword.
transient - Declares that an instance field is not part of the default serialized form of an object. When an object is serialized, only the values of its non-transient instance fields are included in the default serial representation. When an object is deserialized, transient fields are initialized only to their default value.
try - Defines a block of statements that have exception handling. If an exception is thrown inside the "try" block, an optional "catch" block can handle declared exception types. Also, an optional "finally" block can be declared that it will be executed when it exits the "try" block and "catch" clauses, regardless of whether an exception is thrown or not. A "try" block must have at least one "catch" clause or a "finally" block.
void - Used in method declarations to specify that the method does not return any value. It can also be used as a nonfunctional statement.
volatile - Used in field declarations to specify that the variable is modified asynchronously by concurrently running threads.
while - Declares a loop that iterates a block of statements. The loop's exit condition is specified as part of the while statement. If "while" appears before the body of the loop, the exit condition is evaluated before the first iteration. If "while" appears after the loop body then the "do" keyword designates the beginning of the loop body, which is executed once before evaluating the exit condition.
