• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About methods and variables in interface.

 
Nigel Chou
Ranch Hand
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which of the following keywords can be applied to the variables or methods of an interface.
A. static B. private C. synchronized D. protected E. public
The mock exam's author regard A.E. as correct. But I think ACDE, because C and D can be applied to methods of an interface.
 
Nain Hwu
Ranch Hand
Posts: 139
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here are the rules:
For methods in an interface, they are implicitly
public abstract. No other modifiers are allowed.
For variables in an interface, they are implicitly
public static final. No other modifiers
are allowed.

[This message has been edited by Nain Hwu (edited October 19, 2001).]
 
Marcus Green
arch rival
Rancher
Posts: 2813
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you considered trying to compile up some code with those modifiers to see for yourself?
Marcus
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic