Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2005

Tip: Looking for answers? Try searching our database.

Implement interface

Thread view: 
Tony Johansson - 29 May 2005 20:22 GMT
Hello!

When a class implaments an Interface must the class implement all methods?
Whan happen if the class don't implament all methods in the interface. Will
it cause compile error then.

//Tony
Murray - 30 May 2005 10:55 GMT
> Hello!
>
[quoted text clipped - 3 lines]
>
> //Tony

Why don't you try it and find out yourself?

A class must implement all methods of the interface, unless the class is
declared as abstract.
James McIninch - 09 Jun 2005 11:56 GMT
<posted & mailed>

> Hello!
>
> When a class implaments an Interface must the class implement all methods?

Yes, that's the idea.

> Whan happen if the class don't implament all methods in the interface.
> Will it cause compile error then.

It doesn't compile.

> //Tony

Signature

Remove '.nospam' from e-mail address to reply by e-mail

Gordon Beaton - 09 Jun 2005 15:30 GMT
> When a class implaments an Interface must the class implement all
> methods? Whan happen if the class don't implament all methods in the
> interface.

You have two choices:

- implement every method required by the interface

or

- declare the missing methods abstract in your class. This forces you
 to declare your class abstract and, as a result, forces you to
 subclass the class (and implement the missing methods) before you
 can create any objects.

> Will it cause compile error then.

Otherwise, yes.

/gordon

Signature

[  do not email me copies of your followups  ]
g o r d o n + n e w s @  b a l d e r 1 3 . s e



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.