Answered Questions

  • When to use Interface over abstract class?

    Abstract Classes: Classes which cannot be instantiated. This means one cannot make a object of this class or in other way cannot create object by saying  ClassAbs abs = new ClassAbs(); where ClassAbs is abstract class.Abstarct classes contains have one or more abstarct methods, ie method body only no implementation.Interfaces: These are same as abstract classes only difference is we an only define...

    seenthil

    • Mar 26th, 2013

    1. If you are creating something that provides common functionality to unrelated classes, use an interface.

    2. If you are creating something for objects that are closely related in a hierarchy, use an abstract class.

    aparna

    • Dec 19th, 2011

    If you want common functionality(generalization) for some classes go for abstract
    If you dont want generalization then go for abstract class

  • What is the diffrence between an Abstract class and Interface

    Vijay Chaudhary

    • Jul 31st, 2005

    Variables declared in Interface are static and final by default.