Appendix Java Keywords


Throughout this book we have discussed words that have special meaning in the Java language. These words are referred to as Java keywords. The keywords are used to declare, modify, and define things, and some of them are operators. Because they have special meaning, keywords cannot be used as identifiers. You can't declare a variable named "final," for instance.

Here is a list of the Java keywords and a brief description of how they are used in the Java language. A more complete description of the keywords and examples of how to use them can be found throughout this book.

abstract ” A modifier applied to a class or method. An abstract class is one that cannot be instantiated . An abstract method is one that must be overridden by a nonabstract subclass.

assert ” Part of an assertion statement declaration.

boolean ” A type that contains a logical true or false value.

break ” A statement used to exit from a switch , while , do , or for statement or from a labeled block of code.

byte ” A type representing a single byte of data.

case ” A label that defines a value that is compared against the expression following a switch statement.

catch ” A clause used to catch and process an exception of a specified type.

char ” A type representing a 16-bit Unicode character.

class ” Used to declare a class.

const ” A reserved keyword that is not currently used by Java.

continue ” A statement that causes program execution to return to the top of the current loop.

default ” The code following the default label is run if none of the case label values match the expression of a switch statement.

do ” A do-while loop will execute a block of code until a condition is met. The condition is tested after the block of code executes.

double ” A type representing a 64-bit double precision floating-point value.

else ” Part of an if-else statement. Defines a block of code that is executed if the condition after the if statement is not met.

extends ” Indicates inheritance.

final ” A modifier applied to classes, methods , and variables . A final class cannot be subclassed. A final method cannot be overridden. A final variable cannot change its value once it is set.

finally ” A clause that can be optionally placed at the end of a try statement. The block of code after a finally clause will be executed whether or not an exception is thrown and whether or not a thrown exception is caught.

float ” A type representing a 32-bit single precision floating-point value.

for ” A flow of control structure that can be used to execute a block of code a number of times.

goto ” Not used in the Java language. Making goto a keyword means you can't use it in your programs even if you wanted to.

if ” A conditional branch statement.

implements ” Used to indicate that a class will implement one or more interfaces.

import ” A statement that allows you to refer to classes and interfaces by their simple names .

instanceof ” Type comparison operator.

int ” A type representing a 32-bit integer value.

interface ” Used to declare an interface.

long ” A type representing a 64-bit integer value.

native ” Indicates that a method is implemented in a language other than Java.

new ” Object creation operator.

package ” A declaration indicating that the contents of a source file will be placed inside a package.

private ” An access modifier. A member with private access is only accessible inside the class in which it is defined.

protected ” An access modifier. A member with protected access is accessible inside the class in which it is defined and by subclasses.

public ” An access modifier. A member with public access is accessible anywhere .

return ” Used to return from the current method.

short ” A type representing a 16-bit integer value.

static ” A member associated with a class rather than with an instance of a class.

strictfp ” A modifier that forces float or double expressions in a class, interface, or method declaration to be explicitly FP-strict.

super ” Refers to a superclass member.

switch ” A flow of control structure that compares an expression against one or more values.

synchronized ” A synchronized method is one that ensures thread-safe data access.

this ” A reference to the current object.

throw ” A statement used to explicitly throw an exception.

throws ” A clause used to declare the exception types that a method can throw.

transient ” Indicates that a member variable should not be serialized.

try ” An exception handling statement. Code that can generate an exception is placed inside a block of code after the try statement.

void ” Indicates that a method does not return a value.

volatile ” If a variable is declared to be volatile , the compiler will not perform certain synchronization optimizations on it.

while ” A construct that executes a block of code as long as a condition is met.



Technical Java. Applications for Science and Engineering
Technical Java: Applications for Science and Engineering
ISBN: 0131018159
EAN: 2147483647
Year: 2003
Pages: 281
Authors: Grant Palmer

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net