Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

In the real world where can i use the interfaces and abstract classes .

 
sajja bala
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers

My dilema is ; in the real world where can i exactly use the interface and the abstract class. I want the clear scenario in the usage.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might start by working through the Java Tutorial chapter on interfaces and inheritance.
 
Atulya Mahajan
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To put it roughly, an interface is an idea, but an abstract class goes a step ahead in implementing that idea, but not completely.

Comparable interface doesnt do anything itself, but any class implementing the interface has the distinct behavior of being able to compare its objects.

An abstract class says that hey, i am implementing some stuff that will apply to all subclasses, but there are some things so specific that it doesnt make any sense for me to define those. That stuff is left for the subclasses.

hope this helps!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic