类型A已经定义了错误 [英] Type A is already defined error

查看:139
本文介绍了类型A已经定义了错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图搜索解决方案,但是我发现我不知道如何在这种情况下应用。请帮我纠正我的代码。

I tried to search for the solution, but what I found I don't know how to apply in this situation. Please help me correct my code.

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

Well, the first thing to check is obviously whether or not you have another class called A in your file or in the same package.

这篇关于类型A已经定义了错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆