Subclass of an abstract class must provide an implementation of the abstract method or declare itself to be abstract. : abstract « Modifiers « SCJP

Home
SCJP
1.Java Source And Data Type
2.Operators
3.Modifiers
4.Type Casting
5.Statements
6.Object Oriented
7.Thread
8.Utility Classes
9.File
SCJP » Modifiers » abstract 
3.7.6.Subclass of an abstract class must provide an implementation of the abstract method or declare itself to be abstract.
abstract class Shape{

   public abstract int area();
}

abstract class AbstractShape extends Shape{

}
class MainClass extends AbstractShape{
   public int area(){
     return 0;
   }
}
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.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.