A class must be declared abstract if it implements an interface but it does not provide implementations for every method. : 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.7.A class must be declared abstract if it implements an interface but it does not provide implementations for every method.
Abstract is the opposite of final
final class, for example, may not be subclassed; an abstract class must be subclassed.


interface MyInterface {
  public void method1();

  public void method2();
}

class MyClass implements MyInterface {
  public void method1() {
  }
}


The type MyClass must implement the inherited abstract method MyInterface.method2()
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.