File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Basic Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic

Basic Java

Mallesh Kundrappu

Joined: Mar 02, 2007
Posts: 2
Hi all
What is the need for Interface in Java. As per my knowledge with interface we can create method declaration and it can be used by any implementing class. Implemeted class will make definition of the declared methods. Why cant we use classes and extneds this class. We can over ride the method. I assume that we can implement so many intefaces not extend so many classes. Other than multiple inherittance do we have any other benifit in interface... Please clarify my doubt.
Deepak Bala

Joined: Feb 24, 2006
Posts: 6662

This belongs in java in general beginner. Anyway, the choice between interfaces and abstract classes is up to you. If you dont have default implementations to provide go for interfaces. Else go for abstract classes

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63852

Please carefully choose the appropriate forum for your posts. This forum is for questions on Servlets.

This post has been moved to a more appropriate forum for you.

[Asking smart questions] [About Bear] [Books by Bear]
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11955

Also, do not double post. You end up wasting many people's time. John and Bear had to waste time on your post in the wrong forum.

We have a FAQ you should read. The relevant parts here are Choose One Forum and Use a Meaningful Subject ("Basic Java" is about as generic as you can get). It would probably be a good idea for you to read all of them, but these two in particular.

This thread is now closed

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
I agree. Here's the link:
subject: Basic Java
It's not a secret anymore!