This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
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 Introducing JavaFX 8 Programming this week in the JavaFX 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: 20128
    
  30

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: 3028
    
  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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: in Interface the instance variables are final, right?So what happens in this code?
 
It's not a secret anymore!