| Author |
Java Question on Interface and classes
|
srinivasa Avvaru
Greenhorn
Joined: Jun 04, 2010
Posts: 4
|
|
|
Suppose i have a variable called i is in interface and in Abstract class .suppose my class extends that class and implements the interface.Then which i values it takes?or it gives Complie or run time error?
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
Welcome to JavaRanch
coming to your question , what is your opinion about it?
|
 |
Martin Vanyavchich
Ranch Hand
Joined: Sep 16, 2008
Posts: 241
|
|
|
If I understand you correctly, then the reference in ambiguous and your class wont compile.
|
SCJP 6, OCMJD 6, OCPJWSD 6
I no good English.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19232
|
|
Martin's right; the following little example proves it:
If you move the "implements Interface" to class Abstract then it will compile because Abstract's i will shadow Interface's i:
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: Java Question on Interface and classes
|
|
|