Abstract class or method : abstract « Modifiers « SCJP






The abstract modifier identifies abstract classes and methods. 

abstract methods must be implemented by a subclass, so they must be inheritable.
abstract methods cannot be private.
abstract methods cannot be final.
abstract methods may have parameters, a return type, and optional throws clause, but are not implemented.
abstract methods end in a semicolon-no curly braces.

The first nonabstract class to extend an abstract class must implement all of the abstract class' abstract methods.
An abstract class cannot be instantiated.
A single abstract method in a class means the whole class must be abstract.
An abstract class can have both abstract and nonabstract methods.


abstract class AbstractClass {
 abstract void method1();
 abstract String method2(Object obj) throws java.io.IOException;
 abstract int method3(long l);
 abstract boolean method4();
}








3.7.abstract
3.7.1.Abstract class or method
3.7.2.The abstract modifier can be applied to classes and methods.
3.7.3.If a class contains one or more abstract methods, the compiler insists that the class must be declared abstract.
3.7.4.A class that is abstract may not be instantiated
3.7.5.Abstract classes provide a way to defer implementation to subclasses.
3.7.6.Subclass of an abstract class must provide an implementation of the abstract method or declare itself to be abstract.
3.7.7.A class must be declared abstract if it implements an interface but it does not provide implementations for every method.
3.7.8.Interfaces are always abstract, but the keyword is optional in the declaration.
3.7.9.Variables can't be declared abstract.
3.7.10.You can have an abstract class with no abstract methods.