Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

my question about interface?

 
Tony Sam
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From javaprepare.com ...
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 think the answer must be B), but c) is also added in the correct answer.
My opinion about interface is that, all variables in interface are implicitly public ,static and final, all methods in interface are impilicitly public abstract ,and interface also can be declared as abstract . interface can only extends other interface, it must use the key word extends, how could an interface extends more than mone other interface? Correct me if i was wrong!
 
amit mawkin
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This is true an interface can extend any number of interface.
Consider this code
<code>
interface A {
public void amethod1();
}
interface B {
public void amethod2();
}
interface C extends A,B {
public void amethod3();
}
</code>
see for yourself

------------------
coffee drinker
-----------------------
Sun Certified Programmer for Java 2 Platform
 
Tony Sam
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay, thank you very much . Coding may sometimes disclose everything
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tony Sam:
okay, thank you very much . Coding may sometimes disclose everything

Not sometimes, ALWAYS
------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic