perbezaan antara abstract class dan interface class dalam java



abstract ClassesInterfaces
abstract class can extend only one class or one abstract class at a time  interface can extend any number of interfaces at a time
abstract  class  can extend from a class or from an abstract class  interface can extend only from an interface
abstract  class  can  have  both  abstract and concrete methods interface can  have only abstract methods
 A class can extend only one abstract classA class can implement any number of interfaces
In abstract class keyword ‘abstract’ is mandatory to declare a method as an abstract In an interface keyword ‘abstract’ is optional to declare a method as an abstract
abstract  class can have  protected , public and public abstract methods Interface can have only public abstract methods i.e. by default
abstract class can have  static, final  or static final  variable with any access specifier interface  can  have only static final (constant) variable i.e. by default


http://beginnersbook.com/2013/05/abstract-class-vs-interface-in-java/

Comments

  1. nice article and it is very useful for me. Difference Between Abstract class and Interface in Java .
    thanks for this nice post.
    keep posting.

    ReplyDelete
    Replies
    1. thanks. good to hear that, I am just refer from others source also.

      Delete
  2. Great, post is so informative and helpfull to everyone , keep posting and checkout my blog java course in pune

    ReplyDelete

Post a Comment

Popular posts from this blog

Lab Network 2024

Submission Lab Java 2024

Tutorial OOP(reversion java)