Re: changing access modifier of base method



On Tue, 22 Jan 2008 23:30:58 -0800, Jon Skeet [C# MVP] <skeet@xxxxxxxxx> wrote:

No, Java has non-virtual methods too - you use the "final" modifier to
seal a method. It's just that unfortunately Java's methods are virtual
by default.

Ah, right.

I keep getting tripped up by "final" in Java. Maybe it's just me, but the exact meaning of the keyword seems to vary quite a bit according to context. It seems to be usable in places where I don't expect the thing to even possibly be virtual, so I forget that it's used to "un-virtual" something. :)

Anyway, sorry for the error. It is true that by default, methods are virtual and so are overridable. I've seen very few instances of "final" methods, though no doubt they exist in select places.

Pete
.



Relevant Pages

  • Re: Static vs Dynamic
    ... >> Java's type system wouldn't hinder you to write straightforward code ... > I guess this is why I have been defending Java. ... I have an abstract syntax tree whose nodes are implemented as class ... on the type of that context object. ...
    (comp.lang.lisp)
  • Re: Time to Say Goodbye, Delphi?
    ... > and eventually result in abundant Delphi jobs. ... I know Java and I managed to participate in at ... IMO, the context should be advertized, not the tools. ...
    (borland.public.delphi.non-technical)
  • Re: Java "interface" vs. OO interface
    ... > I think Java uses interfaces instead of classes because the designers ... To think that the designers of Java and .NET couldn't figure out a good ... Enough for a language to adopt a new keyword ...
    (comp.object)
  • Re: Jython inherit from Java class
    ... Compiling .java to .class... ... 'assert' is a keyword, and may not be used as an identifier ... release 1.5, 'enum' is a keyword, and may not be used as an identifier ...
    (comp.lang.python)
  • Re: Global Functions
    ... The Shared keyword describes in my idea much better logical what it does ... Java is for me an island from Indonesia. ... is to ask why then haven't other languages adopted this really cool ... programming), Interface, Module, etc. ...
    (microsoft.public.dotnet.languages.vb)