This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Java in General and the fly likes Java Question on Interface and classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Java Question on Interface and classes" Watch "Java Question on Interface and classes" New topic
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: 19697
    
  20

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 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
GeeCON Prague 2014
 
subject: Java Question on Interface and classes