It's not a secret anymore!
The moose likes Java in General and the fly likes Java Question on Interface and classes Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply 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: 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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Java Question on Interface and classes
 
Similar Threads
Please tell me the difference between these two code example
difference between two type of null checks
Doubt regarding Interface methods
Inheritance
how to create tablespace in java dbms