From: Alan E. <ala...@gm...> - 2006-04-19 22:08:10
|
hi vampire, Just because you're not allowed to overload on return type doesn't mean that the javac compiler doesn't encode the return type in the compiled function's signature. you can tell from looking at the exception thrown by gruntspud that the JRE is specifically "looking" for a void function, and not finding it. And then you can check the source to verify that there is indeed a setShell() method which does accept the correct arguments but doesn't return void. --alan On 4/19/06, Vampire <Vam...@gm...> wrote: > Really? In Java? *confused* > Then please explain me why the compiler tells you for the following class= : > > public class Test { > public static void testMethod(String test) { > System.out.println("void: "+test); > } > > public static String testMethod(String test) { > System.out.println("String: "+test); > return test; > } > > public static void main(String[] args) { > testMethod("testVoid"); > String test =3D testMethod("testString"); > System.out.println("main: "+test); > } > } > > the following: > > C:\>javac Test.java > Test.java:6: testMethod(java.lang.String) is already defined in Test > public static String testMethod(String test) { > ^ > Test.java:13: incompatible types > found : void > required: java.lang.String > String test =3D testMethod("testString"); > ^ > 2 errors > > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job ea= sier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronim= o > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > -- > ----------------------------------------------- > jEdit Users' List > jEd...@li... > https://lists.sourceforge.net/lists/listinfo/jedit-users > |