java中这种结构可以正常运行,会引发一些问题吗???
public class SuperClass {
public String test() {
System.out.println("===SuperClass test " );
return "new Exception()";
}
}
...
public class SubClass extends SuperClass {
public SubClass() {
}
public Exception test() {
System.out.println("===subclass 我的返回值是Exception");
return new Exception();
}
}
...
Exception test1 = new SubClass().test();
String test2 = new SuperClass().test();