Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-09-2007, 10:59 AM
Member
 
Join Date: Dec 2007
Posts: 7
Kavana Krishnappa is on a distinguished road
Interfaces
Hi,

Can you tel me more about interfaces & in what applications can we implement that concept..
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-09-2007, 01:59 PM
Corvin's Avatar
Member
 
Join Date: Dec 2007
Location: Germany
Posts: 2
Corvin is on a distinguished road
Send a message via ICQ to Corvin Send a message via AIM to Corvin Send a message via MSN to Corvin Send a message via Yahoo to Corvin Send a message via Skype™ to Corvin
Have a look at this page:
Interface (Java - Wikipedia, the free encyclopedia)
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 12-10-2007, 10:44 AM
Senior Member
 
Join Date: Nov 2007
Location: Newport, WA
Posts: 141
staykovmarin is on a distinguished road
Interfaces can be used to tell in implementing class that it NEEDS to have those methods implemented. Since java does not support multiple inheritance (ie. extend more than one object) it is usefull to tell something it needs to conform to a certain standard.

Basicly, lets say you create an interface with a single method void called foo(). In interfaces, methods cannot have bodies, so it will look something like:
Code:
public interface FooInterface { public void foo(); }
Then in your class you can do:
Code:
public class BarClass implements FooInterface { }
If you tried to compile something like this it will give you an error, because you need the foo() method.

Code:
public class BarClass implements FooInterface { public void foo() { // blah } }
I use interfaces mostly when i am creating a complicated class/sublass structure, and want all my code to conform to a certain standard.
A plugin system would be an example of using interfaces.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 12-11-2007, 05:09 PM
Member
 
Join Date: Dec 2007
Posts: 7
Kavana Krishnappa is on a distinguished road
Thank u..
can you suggest me any small real time application on which i can do a project in core Java..
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 12-11-2007, 05:30 PM
JavaBean's Avatar
Moderator
 
Join Date: May 2007
Posts: 1,272
JavaBean is on a distinguished road
Kavana, try creating a new thread instead of spamming old threads. In that way, you can find better answers if you select appropriate thread titles.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 12-11-2007, 05:32 PM
Member
 
Join Date: Dec 2007
Posts: 7
Kavana Krishnappa is on a distinguished road
Is it a disadvantage of interface?
It was given as,
A class which implements an interface must either implement all methods in the interface, or be an abstract class.
- since a class which implements an interface has to implement all the methods of that interface, is it not a disadvantage that it has to implement all methods even if we want only some methods to be implemented..
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 12-11-2007, 05:40 PM
Member
 
Join Date: Dec 2007
Posts: 7
Kavana Krishnappa is on a distinguished road
i did not understand what you told sir.. did you mean that i should post my queries directly than just replying to their replies.. i am new to this forum so am not much familiar how to use..
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 12-11-2007, 06:28 PM
JavaBean's Avatar
Moderator
 
Join Date: May 2007
Posts: 1,272
JavaBean is on a distinguished road
Quote:
did you mean that i should post my queries directly than just replying to their replies..
Yes! Your query below is not related to this thread. Go to appropriate forum index and click "New Thread" button, instead of clicking to the "Post Reply" button here.

Quote:
can you suggest me any small real time application on which i can do a project in core Java..
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
interfaces.. sireesha New To Java 5 01-16-2008 07:52 PM
Using interfaces with Delegation Java Tip Java Tips 0 12-06-2007 03:49 PM
Using Interfaces JavaForums Java Blogs 0 11-08-2007 03:30 PM
Help, someone clear up Interfaces for me mathias New To Java 1 08-06-2007 04:26 AM
Interfaces imran_khan New To Java 5 07-30-2007 10:11 AM


All times are GMT +3. The time now is 04:07 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org