Header Ads

List of Java Keywords

List of Java Keywords

KeywordDescription
abstractSpecifies that a class or method will be implemented later, in a subclass
assertAssert describes a predicate (a true–false statement) placed in a Java program to indicate that the developer thinks that the predicate is always true at that place. If an assertion evaluates to false at runtime, an assertion failure results, which typically causes execution to abort.
booleanA data type that can hold True and False values only
breakA control statement for breaking out of loops
byteA data type that can hold 8bit data values
caseUsed in switch statements to mark blocks of text
catchCatches exceptions generated by try statements
charA data type that can hold unsigned 16bit Unicode characters
classDeclares a new class
continueSends control back outside a loop
defaultSpecifies the default block of code in a switch statement
doStarts a dowhile loop
doubleA data type that can hold 64bit floatingpoint numbers
elseIndicates alternative branches in an if statement
enumA Java keyword used to declare an enumerated type. Enumerations extend the base class
extendsIndicates that a class is derived from another class or interface
finalIndicates that a variable holds a constant value or that a method will not be overridden
finallyIndicates a block of code in a trycatch structure that will always be executed
floatA data type that holds a 32bit floatingpoint number
forUsed to start a for loop
ifTests a true/false expression and branches accordingly
implementsSpecifies that a class implements an interface
importReferences other classes
instanceofIndicates whether an object is an instance of a specific class or implements an interface
intA data type that can hold a 32bit signed integer
interfaceDeclares an interface
longA data type that holds a 64bit integer
nativeSpecifies that a method is implemented with native (platformspecific) code
newCreates new objects
nullIndicates that a reference does not refer to anything
packageDeclares a Java package
privateAn access specifier indicating that a method or variable may be accessed only in the class it’s declared in
protectedAn access specifier indicating that a method or variable may only be accessed in the class it’s declared in (or a subclass of the
classit’s declared in or other classes in the same package)
publicAn access specifier used for classes, interfaces, methods, and variables indicating that an item is accessible throughout the application (or where the class that defines it is accessible)
returnSends control and possibly a return value back from a called method
shortA data type that can hold a 16bit integer
staticIndicates that a variable or method is a class method (rather than being limited to one particular object)
strictfpA Java keyword used to restrict the precision and rounding of floating point calculations to ensure portability
superRefers to a class’s base class (used in a method or class constructor)
switchA statement that executes code based on a test value
synchronizedSpecifies critical sections or methods in multithreaded code
thisRefers to the current object in a method or constructor
throwCreates an exception
throwsIndicates what exceptions may be thrown by a method
transientSpecifies that a variable is not part of an object’s persistent state
tryStarts a block of code that will be tested for exceptions
voidSpecifies that a method does not have a return value
volatileIndicates that a variable may change asynchronously
whileStarts a while loop

No comments:

Powered by Blogger.