Jason R. Kretzer<br />Software Engineer<br />System Administrator<br /><a href="http://alia.iwarp.com" target="_blank" rel="nofollow">http://alia.iwarp.com</a>
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Originally posted by Phil Perkins:
Can you overload a static method?
Originally posted by mark stone:
public class A {
static void mm()
{System.out.println("mm");}
static void mm(int a)
{System.out.println("mm");}
}
method mm() is static and we overloaded it.
where is the problem. i am not sure if this is the question you were asking. methods can be overloaded. period. ( static or non-static )
or are you asking overriding, then also it is fine
class B extends A {
static void mm()
{System.out.println("mm-overriding");}
}
method mm() is overridden in class B and is ok. so again methods can be overridden (static or non-static)
Rob
SCJP 1.4
Originally posted by Vanitha Sugumaran:
Static methods don't participate in overriding, in the example you have shown the method mm() is not being overridden, if you read the JLS part that Ajith has pointed out, you will understand it.
Vanitha.
Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
it's a teeny, tiny, wafer thin ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|