• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Interfaces...need some help.

 
SurferBoy
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im learning java from a book...
the problem is ..that i cant really understand the idea behind interfaces.
tried looking for some help on "google"...but to no avail.
i know that java doesnt support multipile inheritance of classes...
but if interfaces doesnt allow implementations...(of methods and variables) so what the use of them anyway???
(if u have an example..it would be great)
thanks in advance...
 
Marilyn de Queiroz
Sheriff
Posts: 9066
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joe nothing,

Welcome to JavaRanch! Please adjust your display name to meet the JavaRanch Naming Policy. If you don't want to use your own name, at least pick a name that looks real. You can change it here.

Thanks!
 
Marilyn de Queiroz
Sheriff
Posts: 9066
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

the problem is ..that i cant really understand the idea behind interfaces.
tried looking for some help on "google"...but to no avail.


You could try the "Search" link at the top right of this page. Or you could go to the main JavaRanch page and use the Google there to search either the static Javaranch pages or the Moose Saloon (this forum).

i know that java doesnt support multipile inheritance of classes...
but if interfaces doesnt allow implementations...(of methods and variables)


What makes you think that you can't implement an interface? That is the whole function of an interface -- to provide a contract to be implemented by one or more classes.
 
Pritam Barhate
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interfaces is a very powerful tool that lets you to have many functionalities of multiple inheritance without complexities of multiple inheritance. Almost all of the collections framework is based on interfaces.

Try to work with collections framework (I am sure your book will have atleast one chapter on it) and you will understand power of interfaces as well of their uses in real world programming.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic