Re: Static methods overridden !!
- From: "Ravi" <v.r.sankar@xxxxxxxxx>
- Date: 25 Mar 2007 12:49:11 -0700
Thanks Eric for elaborate explanation on static method calls.
Will you accept an explanation that's not from the JVMNot a problem :)
point of view, but from the Java language point of view?
Java calls the doit() method of the class
that matches the declared type of the `thing' reference.
Well, the class doesn't have the method at all ! Please refer the
original code again. CowTest class doesn't have saySomething method at
all . It has saySomething1 (1 (one) extra in the end, may be I should
have made this more clearly differentiating). I am not referring the
objects here and I am clear on the fact that objects have nothing to
do with invocation of static methods.
you can replace new CowTest().saySomething(); with
CowTest.saySomething(); if it makes things simpler.
Clearly saySomething comes from super class. This is confusing for
me.
Regards,
Ravi
.
- Follow-Ups:
- Re: Static methods overridden !!
- From: Joshua Cranmer
- Re: Static methods overridden !!
- From: Lew
- Re: Static methods overridden !!
- References:
- Static methods overridden !!
- From: Ravi
- Re: Static methods overridden !!
- From: Daniel Pitts
- Re: Static methods overridden !!
- From: Ravi
- Re: Static methods overridden !!
- From: Eric Sosman
- Static methods overridden !!
- Prev by Date: Re: Class Libraries !! ?
- Next by Date: Re: Class Libraries !! ?
- Previous by thread: Re: Static methods overridden !!
- Next by thread: Re: Static methods overridden !!
- Index(es):