• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
shoeb sayyed
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Rob Spoor
Sheriff
Pie
Posts: 20671
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
shoeb sayyed
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok i got it
thanks
 
Mike Simmons
Ranch Hand
Posts: 3090
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic