modifiers chart

 

  The chart shows where modifiers can legally appear.

 

ALLOWABLE

MODIFIERS

 

can go

on a
CLASS

 

can go

on a
METHOD

 

can go

on a
VARIABLE

 

can go

on a
CONSTRUCTOR

on a

NAMED
INNER
CLASS

 

can go

in an

INTERFACE

abstract

NO

NO

√ optional on its methods

final

NO

√ on all variables

native

NO

NO

NO

NO

NO

private

NO

NO

protected

NO

NO

public

static

NO

√ optional on all final variables

strictfp

NO

NO

NO

NO

synchronized

NO

NO

NO

NO

NO

transient

NO

NO

NO

NO

NO

volatile

NO

NO

NO

NO

NO

void

NO

NO

NO

NO

NO

also:

 

 

 

 

 

 

throws

NO

NO

NO

NO

( no modifier )

NO 1

NO 2

 

1  Methods need void or a return type.

2  Variables need a type.