我试图搜索解决方案,但是我发现我不知道如何在这种情况下应用.请帮我纠正我的代码.
package Exercise; public class Ex11_11 { public static void main(String[] args) { A a = new A(3); } } class A extends B { // type A is already defined,A has a red underline public A (int t) { System.out.println("A's constructor is invoked"); } } class B { // type B is already defined,B has a red underline public B () { System.out.println("B's constructor is invoked"); } }
解决方法
那么,首先要检查的是显然你的文件或同一个包中是否有另一个类叫做A.