0% found this document useful (0 votes)
40 views

Java v20 Keywords

The document defines Java keywords and their meanings. It lists over 30 keywords and provides a brief definition for each one. The keywords cover basic concepts like class, boolean, if/else as well as more advanced topics like abstract, final, and synchronized.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Java v20 Keywords

The document defines Java keywords and their meanings. It lists over 30 keywords and provides a brief definition for each one. The keywords cover basic concepts like class, boolean, if/else as well as more advanced topics like abstract, final, and synchronized.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Java Keywords

Keyword Definition

A Java(TM) programming language keyword used in a class definition to specify that a class
abstract is not to be instantiated, but rather inherited by other classes. An abstract class can have
abstract methods that are not implemented in the abstract class, but in subclasses.

Refers to an expression or variable that can have only a true or false value. The Java(TM)
boolean
programming language provides the boolean type and the literal values true and false.

A Java(TM) programming language keyword used to resume program execution at the


break statement immediately following the current statement. If followed by a label, the program
resumes execution at the labeled statement.

byte A sequence of eight bits. The Java(TM) programming language provides a corresponding
byte type.

A Java(TM) programming language keyword that defines a group of statements to begin


case
executing if a value specified matches the value defined by a preceding switch keyword.

A Java(TM) programming language keyword used to declare a block of statements to be


catch executed in the event that a Java exception, or runtime error, occurs in a preceding try
block.

char A Java(TM) programming language keyword used to declare a variable of type character.

In the Java(TM) programming language, a type that defines the implementation of a


particular kind of object. A class definition defines instance and class variables and
class methods, as well as specifying the interfaces the class implements and the immediate
superclass of the class. If the superclass is not explicitly specified, the superclass will
implicitly be object.

const This is a reserved Java(TM) programming language keyword. However, it is not used by
current versions of the Java programming language.

A Java(TM) programming language keyword used to resume program execution at the end
continue of the current loop. If followed by a label, continue resumes execution where the label
occurs.

1-4 Fundamentals of Java Programming v 2.0 – Keywords Copyright  2004, Cisco Systems, Inc.
A Java(TM) programming language keyword optionally used after all case conditions in
Default a switch statement. If all case conditions are not matched by the value of the switch
variable, the default keyword will be executed.

A Java(TM) programming language keyword used to declare a loop that will iterate a
do
block of statements. The loop's exit condition can be specified with the while keyword.

double A Java(TM) programming language keyword used to define a variable of type double.

A Java(TM) programming language keyword used to execute a block of statements in


else
the case that the test condition with the if keyword evaluates to false.

Class X extends class Y to add functionality, either by adding fields or methods to class
extends Y, or by overriding methods of class Y. An interface extends another interface by
adding methods. Class X is said to be a subclass of class Y.

A Java(TM) programming language keyword. You define an entity once and cannot
change it or derive from it later. More specifically, a final class cannot be subclassed,
final
a final method cannot be overridden and a final variable cannot change from its
initialized value.

A Java(TM) programming language keyword that executes a block of statements


finally regardless of whether a Java exception, or runtime error, occurred in a block defined
previously by the try keyword.

float A Java(TM) programming language keyword used to define a floating point number
variable.

A Java(TM) programming language keyword used to declare a loop that reiterates


for statements. The programmer can specify the statements to be executed, exit conditions,
and initialization variables for the loop.

goto This is a reserved Java(TM) programming language keyword. However, it is not used by
current versions of the Java(TM) programming language.

if A Java(TM) programming language keyword used to conduct a conditional test and


execute a block of statements if the test evaluates to true.

implements A Java(TM) programming language keyword optionally included in the class declaration
to specify any interfaces that are implemented by the current class.

A Java(TM) programming language keyword used at the beginning of a source file that
import can specify classes or entire packages to be referred to later without including their
package names in the reference.

instanceof A two-argument Java(TM) programming language keyword that tests whether the run-
time type of its first argument is assignment compatible with its second argument.

int A Java(TM) programming language keyword used to define a variable of type integer.

A Java(TM) programming language keyword used to define a collection of method


interface definitions and constant values. It can later be implemented by classes that define this
interface with the implements keyword.

long A Java(TM) programming language keyword used to define a variable of type long.

2-4 Fundamentals of Java Programming v 2.0 – Keywords Copyright  2004, Cisco Systems, Inc.
A Java(TM) programming language keyword that is used in method declarations to
native specify that the method is not implemented in the same Java source file, but rather in
another language.

new A Java(TM) programming language keyword used to create an instance of a class.

package A group of types. Packages are declared with the package keyword.

private A Java(TM) programming language keyword used in a method or variable declaration. It


signifies that the method or variable can only be accessed by other elements of its class.

A Java(TM) programming language keyword used in a method or variable declaration. It


protected signifies that the method or variable can only be accessed by elements residing in its
class, subclasses, or classes in the same package.

A Java(TM) programming language keyword used in a method or variable declaration. It


public signifies that the method or variable can be accessed by elements residing in other
classes.

return A Java(TM) programming language keyword used to finish the execution of a method. It
can be followed by a value required by the method definition.

short A Java(TM) programming language keyword used to define a variable of type short.

A Java(TM) programming language keyword used to define a variable as a class


variable. Classes maintain one copy of class variables regardless of how many instances
static exist of that class. static can also be used to define a method as a class method.
Class methods are invoked by the class instead of a specific instance, and can only
operate on class variables.

strictfp A Java(TM) programming language keyword used to control over floating-point


arithmetic.

super A Java(TM) programming language keyword used to access members of a class


inherited by the class in which it appears.

A Java(TM) programming language keyword used to evaluate a variable that can later
switch be matched with a value specified by the case keyword in order to execute a group of
statements.

synchronized A keyword in the Java(TM) programming language that, when applied to a method or
code block, guarantees that at most one thread at a time executes that code.

A Java(TM) programming language keyword that can be used to represent an instance


this of the class in which it appears. this can be used to access class variables and
methods.

A Java(TM) programming language keyword that allows the user to throw an exception
throw
or any class that implements the "throwable" interface.

A Java(TM) programming language keyword used in method declarations that specify


throws which exceptions are not handled within the method but rather passed to the next higher
level of the program.

3-4 Fundamentals of Java Programming v 2.0 – Keywords Copyright  2004, Cisco Systems, Inc.
A keyword in the Java(TM) programming language that indicates that a field is not part of the
Transient serialized form of an object. When an object is serialized, the values of its transient fields are
not included in the serial representation, while the values of its non-transient fields are
included.

A Java(TM) programming language keyword that defines a block of statements that may
throw a Java language exception. If an exception is thrown, an optional catch block can
try
handle specific exceptions thrown within the try block. Also, an optional finally block will
be executed regardless of whether an exception is thrown or not.

A Java(TM) programming language keyword used in method declarations to specify that the
void
method does not return any value. void can also be used as a nonfunctional statement.

volatile A Java(TM) programming language keyword used in variable declarations that specifies that
the variable is modified asynchronously by concurrently running threads.

while A Java(TM) programming language keyword used to declare a loop that iterates a block of
statements. The loop's exit condition is specified as part of the while statement.

4-4 Fundamentals of Java Programming v 2.0 – Keywords Copyright  2004, Cisco Systems, Inc.

You might also like