Amazon Interview Question
Software Engineer in TestsWithin the confines of Java syntax, an interface is a type that only defines abstract methods and constant members. In a more general sense, an interface is an abstract class that defines no implementation. Neither an interface nor an abstract class can be directly instantiated. However, an abstract class may define non-constant members and non-abstract methods. An abstract class is often used to define the common set of features required of its implementing subclasses, including data structures and method implementations. An interface is used to define only the methods and constants that are to be shared by its implementers. You may implement an interface using the implements keyword and extend an abstract class using the extends keyword. When you implement an interface, you must provide the code for all of the methods in the interface. When you extend an abstract class, you inherit all of the implemented methods and only need to implement those that were left undefined (abstract).
C# world
1. Interface allows multiple inheritances where abstract class not
2. all Interface methods are public by definition where abstract class can have different access level (private, protected and etc)
3. Abstract class can have implemetation of the method along with difiniton only where Interface only holds difinition
# We can not make instance of Abstract Class as well as Interface.
- googler August 13, 2009# Abstract class can contain abstract methods, abstract property as well as other members (just like normal class).
Interface can only contain abstract methods, properties but we don’t need to put abstract and public keyword. All the methods and properties defined in Interface are by default public and abstract.
# abstact class is a abstract view of any realword entity and interface is more abstract one
http://geekswithblogs.net/mahesh/archive/2006/07/05/84120.aspx