Skip to main content
Local Variables
- Local (method, automatic, or stack) variable declarations cannot have access modifiers.
- final is the only modifier available to local variables.
- Local variables don't get default values, so they must be initialized before use.
- final methods cannot be overridden in a subclass.
- abstract methods are declared, with a signature, a return type, and an optional throws clause, but are not implemented.
- abstract methods end in a semicolon—no curly braces.
- Three ways to spot a non-abstract method:
- The method is not marked abstract.
- The method has curly braces.
- The method has code between the curly braces.
- The first nonabstract (concrete) class to extend an abstract class must implement all of the abstract class' abstract methods.
- The synchronized modifier applies only to methods and code blocks.
- synchronized methods can have any access control and can also be marked final.