wood burning stoves*
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 Murach's Java Servlets and JSP this week in the Servlets 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: 19651
    
  18

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
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: 2988
    
    9
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?
 
Similar Threads
A static class ?
interface doubt
Question about class and interface
Strange question