Java Abstract & Interfaces


Web tier: servlets, JSP, Web frameworks: Java Abstract & Interfaces

  1. Java Abstract & Interfaces (1 messages)

    What is difference between abstract classes and interfaces? Can any one explain what is use of those in real situations?Where its exactly used?
  2. Abstracts and IF[ Go to top ]

    Hi, I'm using Abstract classes when I use inheritence to add functionality to a set of classes. For instance: If you need all of your controller classes to have a getUser() method, and you need them all to implement an execute() method, then you can use abstract classes. The getUser() will be a normal method and the execute method could be abstract. Interfaces simply force you to implement certain methods. They give you no functionality. But you can implement as many as you want :o) /Thomas