Variables defined in interface are public static and final so I was thinking that we should not be able to override the variables in a class thats implementing the interface.
But when I am compiling the below class, it compiles fine and gives the correct values. but when I did disp.abhi = 35; it gives a compile error (cannot override final variable)
There are other people who waited much more than 5 years between registration and first post
I added code tags to your post: doesn't it look better:) Always use the tags.
I guess this is what is called as "Shadowing". And yes, I will use tags going forward while posting questions. I have been preparing for 803 certificaion for 2-3 months and trying different combinations to see how will the code behave.
The code provided compiles? Really?
It doesn't for me.
On the line:
Error: cannot instantiate the type display
Oh, and the reason for the error you mentioned: As well as being public and static, any variables declared in an interface are also final.
So assigning a new value to them is an error.
Post by:autobot
No. No. No. No. Changed my mind. Wanna come down. To see this tiny ad:
a bit of art, as a gift, the permaculture playing cards