aspose file tools
The moose likes Beginning Java and the fly likes in Interface the instance variables are final, right?So what happens in this code? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "in Interface the instance variables are final, right?So what happens in this code?" Watch "in Interface the instance variables are final, right?So what happens in this code?" New topic
Author

in Interface the instance variables are final, right?So what happens in this code?

shoeb sayyed
Ranch Hand

Joined: Mar 14, 2010
Posts: 48


Thanks,
Shoeb
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19958
    
  25

You already said that k is static. It's static to foo though, so foo.k is valid. Class Test inherits this static field because of the implementing of foo.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
shoeb sayyed
Ranch Hand

Joined: Mar 14, 2010
Posts: 48
ok i got it
thanks
Mike Simmons
Ranch Hand

Joined: Mar 05, 2008
Posts: 3019
    
  10
Also, since it's static, it should not be referred to as an instance variable (even though it looks like one, since "static" is not explicitly shown). Instead, it's a class (static) variable.
 
Have you tried LearnNowOnline? http://www.learnnowonline.com/
 
subject: in Interface the instance variables are final, right?So what happens in this code?