View RSS Feed

Recent Blogs Posts

  1. Abstract class vs Interface

    by , 01-08-2012 at 11:15 AM
    Base classes are used to present interface to its child classes in design. It supports that base class cannot be instantiated. It can be only up casted and its interface is used only. To achieve this, mark the base class as abstract. Compiler gives an error, if you try to create an object of abstract class.

    The interface helps and improves the concept of abstract class. In interfaces, you can only declare methods and cannot provide implementation. The child class which is implementing ...
    Categories
    Interface
  2. Working With Interfaces

    by , 11-08-2011 at 06:33 PM (My Java Tips)
    Interface is very much similar to the Abstract class in Java but the difference is that in interfaces, members (methods) cannot be implemented, member(fields) defined will be treated as constants.
    A class becomes more formal about its behavior after implementing an interface. Interfaces are actually a contract between the class and the outside world. While implementing an interface in a concrete class, you have to implement all the methods defined by that interface. If you miss any method, ...
    Categories
    Java SE