Originally posted by Fire Feather:
Hello , everybody!
I have tested the following code just now.It can be compiled and ran well. You can try it yourself!
class A
{
public static void main(String[]A)
{
B b=new B();
System.out.println(b);
}
}
class B
{
int B(){return 3;}
}
In my opinion,the compiler may delete or ignore the return type and return statement! Can anbody explain that ? waiting...........
Hi Fire Feather,
I suspect you're going to get some heat about your display name...
Aside from that, in your B class:
The B() method is not a constructor because it has a return type. It is simply just another ho-hum method to the compiler. To qualify as a constructor, throw away the return type and return value:
Aloha,
Doug
-- Nothing is impossible if I'mPossible
[ October 18, 2007: Message edited by: Doug Slattery ]