Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Maneesh Godbole wrote:What happens when you try out the following:
compiler treats it as a different method though it has a same name as the static method?
s sivaraman wrote:
i was right on this.wasn't i?
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Les Morgan wrote:
s sivaraman wrote:
i was right on this.wasn't i?
That overloading is not a problem, but the following seems to be a problem:
None of those are static Classes, but the static method is supposed to resolve back to the Class, not the Instance, but class B does infact do an Override of F1() from A, but if I try to use the Annotation @Override, my NetBeans says there is no method to override, but as displayed in the call from JStaticJunk there is an F1(int) inherited from A, so where did F1() go? In all of it the Class variable works properly.
s sivaraman wrote:
would it compile? because you cannot access a static method by an instance reference.
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
run:
This is F1(int) 11
This is F1()11
F1() 11
This is F1(int) 12
This is F1()12
BUILD SUCCESSFUL (total time: 0 seconds)
Notice that class variable behaves just like it is supposed to do.
s sivaraman wrote:
Then why using the code syntax that affects the readability?
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
s sivaraman wrote:
would it compile? because you cannot access a static method by an instance reference.
Trying to collect the broken pieces of my life,in the process of making out a beautiful picture out of it.
s sivaraman wrote:what is happening ?
either the static method is overloaded as non static method
or
compiler treats it as a different method though it has a same name as the static method?
s sivaraman wrote:because you cannot access a static method by an instance reference.
Les Morgan wrote:but class B does infact do an Override of F1() from A, but if I try to use the Annotation @Override, my NetBeans says there is no method to override, but as displayed in the call from JStaticJunk there is an F1(int) inherited from A, so where did F1() go? In all of it the Class variable works properly.
It will give me the powers of the gods. Not bad for a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|