difference between Abstract class and interface in java
2012-12-29 08:41
489 查看
1. An abstract class is a class that is only partially implemented. It may contain none
or multiple abstract methods. An abstract method is simply a function definition that must be implemented in a child class.
2. An interface is a fully abstract class; none of its methods are implemented.
3. Variables declared in a Java interface is by default final. An abstract class may contain non-final variables.
4. An abstract class can have a constructor.
5. Members of a Java interface are public by default. A Java abstract class can have the usual flavors of class members like
private, protected, etc..
6. A Java class can implement multiple interfaces but it can extend only one abstract class.
or multiple abstract methods. An abstract method is simply a function definition that must be implemented in a child class.
2. An interface is a fully abstract class; none of its methods are implemented.
3. Variables declared in a Java interface is by default final. An abstract class may contain non-final variables.
4. An abstract class can have a constructor.
5. Members of a Java interface are public by default. A Java abstract class can have the usual flavors of class members like
private, protected, etc..
6. A Java class can implement multiple interfaces but it can extend only one abstract class.
相关文章推荐
- difference between Abstract class and interface in java
- What’s the difference between an interface and an abstract class in Java?
- difference between Interface and abstract class in Java
- Difference between Abstract Class and Interface in Java
- Java - Difference between Abstract class and Interface
- Difference between Abstract class and interface
- What is difference between abstract class and interface
- the Differences between abstract class & interface in C#接口和抽象类的区别
- Difference Between Class.ForName() And ClassLoader.LoadClass() Methods In Java
- Why do many Collection classes in Java extend the abstract class and implement the interface as well
- difference between abstract class and interface
- Differences between abstract class and interface
- Java中的抽象类和接口 (Abstract Class and Interface in Java)
- 【转载】#445 - Differences Between an Interface and an Abstract Class
- Programming in Java: Multi-threads and interface vs abstract class
- Difference between Stack and Heap memory in Java
- Difference between DOM and SAX Parsers in Java
- Java - Difference between HashMap and HashSet in Java
- Difference between HashSet and HashMap in Java
- Programming in Java: Multi-threads and interface vs abstract class