物件導向程式設計

 

 

      2.4 Java保留字(Keywords)

 

 


授課教師:陳慶瀚

WWW : http://www.miat.ee.isu.edu.tw/java

E-mail : pierre@isu.edu.tw   

 


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Keyword

Purpose

abstract

declares that a class or method is abstract

boolean

declares a boolean variable or return type

break

prematurely exits a loop

byte

declares a byte variable or return type

case

one case in a switch statement

catch

handle an exception

char

declares a character variable or return type

class

signals the beginning of a class definition

continue

prematurely return to the beginning of a loop

default

default action for a switch statement

do

begins a do while loop

double

declares a double variable or return type

else

signals the code to be executed if an if statement is not true

extends

specifies the class which this class is a subclass of

final

declares that a class may not be subclassed or that a field or method may not be overridden

finally

declares a block of code guaranteed to be executed

float

declares a floating point variable or return type

for

begins a for loop

if

execute statements if the condition is true

implements

declares that this class implements the given interface

import

permit access to a class or group of classes in a package

instanceof

tests whether an object is an instanceof a class

int

declares an integer variable or return type

interface

signals the beginning of an interface definition

long

declares a long integer variable or return type

native

declares that a method is implemented in native code

new

allocates a new object

package

defines the package in which this source code file belongs

private

declares a method or member variable to be private

protected

declares a class, method or member variable to be protected

public

declares a class, method or member variable to be public

return

returns a value from a method

short

declares a short integer variable or return type

static

declares that a field or a method belongs to a class rather than an object

super

a reference to the parent of the current object

switch

tests for the truth of various possible cases

synchronized

Indicates that a section of code is not thread-safe

this

a reference to the current object

throw

throw an exception

throws

declares the exceptions thrown by a method

transient

This field should not be serialized

try

attempt an operation that may throw an exception

void

declare that a method does not return a value

volatile

Warns the compiler that a variable changes asynchronously

while

begins a while loop


 

物件導向程式設計

義守大學電機系 陳慶瀚

2001.10.02