• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

what is "interface"? and how to use it?

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks!
 
Bartender
Posts: 1840
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See this thread for an explaination.
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In one of the interviews i attended i was asked the following question:

" Abstract classes are more faster than Interfaces in implementation, then y do we go for interfaces over an abstarct class, and y in Java we find many interfaces? as almost everything is an interface."

what is the exact answer for this? My answers didn't satisfy them.

Thanks!
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I doubt that there is an "exact answer". However, this topic has been discussed on several occassion here at the Saloon. You should use the Search tool to find these threads. Using something like "interface abstract class" as the search keywords should turn up some decent results.

Keep coding!

Layne
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As for why we find so many interfaces ... Many design patterns and object oriented principles are focused on reducing dependency between classes, packages and larger grained components. They try to isolate sites of change - if this class changes often keep it away from classes that never change so we can avoid breaking the stable class and better organize our testing - and make change possible - I can introduce a new widget without modifying the thing that uses widgets. It's a fascinating area of study that repidly takes you into fairly advanced territory!

Google for "patterns in Java" to see some examples. HERE is something I put together for my team that shows some examples, too.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!