• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why interface does not allow to reference a variable in super class using super keywo  RSS feed

 
thomas davis
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

//Why interface does not allow to reference a variable in super class using super keyword?
[ August 03, 2003: Message edited by: Jim Yingst ]
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"super" refers to the superclass of a class. An interface implemented by that class is not its superclass.
In the example you give, the "super" is not needed. If you need to refer to a variable in an interface that you've hidden by declaring a variable of the same name in a class that implements it, then you can use the interface name instead of "super" -- i.e., "inttest1.i" -- because all variables in interfaces are implicitly static.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!