wood burning stoves*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Inheritance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Inheritance" Watch "Inheritance" New topic
Author

Inheritance

Mary Robert
Greenhorn

Joined: Jan 04, 2001
Posts: 13
Hi! friends,
This is a question rom a mock exam..
Which of the following are true about interfaces. Select all correct answers.
a)Methods declared in interfaces are implicitly private.
b)Variables declared in interfaces are implicitly public, static, and final.
c)An interface can extend any number of interfaces.
d)The keyword implements indicate that an interface inherits from another.
I thought the answer would be only 'b'. But it is given that the answer is b & c. How is this?
As of my knowledge, u can extend atmost one class and implement multiple interfaces. Is it not true with the interfaces too?
Please help me..
Thank u
Mary.
Sean Casey
Ranch Hand

Joined: Dec 16, 2000
Posts: 625
The answers b and c are correct. An interface can extend several interfaces, unlike classes.
Tom Pridham
Ranch Hand

Joined: Feb 06, 2001
Posts: 92
Answer C is not worded correctly. An interface can only extend one interface, not multiples (same as classes).
I see why it is confusing. Answer C should be re-worded to say something like "c) An interface can extend another interface." or something like that.
Sean Casey
Ranch Hand

Joined: Dec 16, 2000
Posts: 625
This is straight from Khalid pg. 197 and I quote "An interface can extend other interfaces, using the extends clause. Unlike extending classes, an interface can extend several interfaces." So Todd I believe your wrong and my original answer is correct. Interfaces can extend multiple interfaces unlike classes. Correct me if I'm wrong.
Tom Pridham
Ranch Hand

Joined: Feb 06, 2001
Posts: 92
Ignore my last post.....Interfaces can extend multiple interfaces like:
public interface a
{
}
interface b
{
}
interface c extends a, b
{
}
This code is legal and compiles correctly.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Inheritance
 
Similar Threads
Q. interface definitions
my question about interface?
help on INTERFACES
Another anoymous question
Interface Theory