Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Greg Brannon wrote:some may prefer a JLS reference.
It is a compile-time error to attempt to override or hide a final method.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Matthew Brown wrote:The thread title doesn't seem to quite match the code. You can't override a final method (that's what it's for). You can override a non-final method and mark it final, which is what the title seems to be about.
Matthew Brown wrote:The thread title doesn't seem to quite match the code. You can't override a final method (that's what it's for). You can override a non-final method and mark it final, which is what the title seems to be about.
Aditya Jha wrote:
To be fair, the thread title says about "overridden method", and usually that is what we call the super class' method. The sub-class method which overrides the super class' (overridden) method is termed as "overriding method".
Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
Greg Brannon wrote:At least that's my interpretation....
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Michael Ernest wrote:For about the same reason you cannot reduce the visiblity of an inherited method, it seemed reasonable to assert you couldn't finalize an inherited method. I dunno if I'm happy a person can finalize, say, equals(), but I guess that's open to programmer discretion.
Michael Ernest wrote:If I override a method I have inherited, such as toString(), the doc I read says I shouldn't be able to mark it final, preventing others from implementing their own version. This idea came to me as I was summing up other ways in Java to effect the behavior of final that is more like protecting the code of the parent than preventing the child from doing its own thing. Anyway.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
I hope you found whoever wrote the article and shot him for mixing C++ terminology (virtual) and Java™ terminology. Another of my pet hates, (not nearly as bad as long lines and 2D arrays ) is people who go round writing about Java™ as if it were a superset of C++. It isn’t. It is a language in its own right, completely different from C++. And I think (my opinion, which I am sure people will disagree with) Gosling &c made a mistake in making it look like C++.Winston Gutkowski wrote: . . . I remember reading an article somewhere that said that 'all Java methods are virtual...unless they're final', . . .
Campbell Ritchie wrote:I hope you found whoever wrote the article and shot him for mixing C++ terminology (virtual) and Java™ terminology.
And I think (my opinion, which I am sure people will disagree with) Gosling &c made a mistake in making it look like C++.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Don’t know, but we can look in the JVM specification. I couldn’t find callvirt, but did find invokevirtual. That is an implementation detail which should be hidden from the public interface. It might be appropriate to use virtual there, if C++ code is used.Winston Gutkowski wrote: . . . isn't one of the Java bytecode commands . . . something like 'callvirt'.
If you make a better mousetrap and it looks like an old‑style mousetrap . . .And I think (my opinion, which I am sure people will disagree with) Gosling &c made a mistake in making it look like C++.
There I'd have to disagree: I think it was one of the foundations of it's success. Certainly, it was the main thing that attracted me to it.
Winston
Campbell Ritchie wrote:I couldn’t find callvirt, but did find invokevirtual.
Fortunately, we can have different opinions, and the newbies can see that different opinions are valid.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Don't get me started about those stupid light bulbs. |