going up from the hierarchy, a String object is found first than Object, which is the parent for all classes. that's the reason public void myMethod(String s) is invoked.
Andres Gonzalez thanks for ur explanation though i didn't ask clearly
and if i rewrite the code and replace the "Object" with "StringBuffer",just like this below
public class test
public void myMethod(StringBuffer o)
public void myMethod(String s)
public static void main(String args)
test t = new test();
it won't compile since the StringBuffer and String are in the same hierarchy and the compiler can't decide which method should invoke.
[ August 07, 2003: Message edited by: Kefe Abalov ]