Monday, June 17, 2013

Java Keywords

abstract


  • class - contains abstract methods, cannot be instantiated
  • interface - all interfaces are implicitly abstract. Optional.
  • method - Signature is followed by semi-colon but no body. The enclosing class must be abstract.

boolean

break
byte
case
catch
char
class
const
continue
default
do
double
else
extends

final


  • class - cannot be subclassed
  • method - cannot be overridden
  • variable - value can be changed (constant)


finally
float
for
goto
if
implements
import
instanceof
int
interface
long

native


  • method - implemented in a language other than Java such C++. Methods do not have bodies.

new
null
package
private
protected
public
return
short

static


  • method - class method. cannot refer to non-static variables and methods of a class. Method is implicitly final. Invoked through class name.
  • variable - only copy regardless of how many class instances are created. Access through the class name.

super
switch

synchronized


  • method - Only one synchronized method can be run for each class.

this
throw
throws
transient
try
void
volatile
while