小编Max*_*ood的帖子

IntelliJ 2018.1.3显示了接口中的所有方法,为什么?

假设我们有以下代码:

public interface Dvd {
   void startDvd();
}
Run Code Online (Sandbox Code Playgroud)

和另一个接口:

public interface Tv {
    void startTv();
}
Run Code Online (Sandbox Code Playgroud)

和一个类:

public class Logitech implements Dvd, Tv {
    @Override
    public void startDvd() {

    }

    @Override
    public void startTv() {

    }
}
Run Code Online (Sandbox Code Playgroud)

然后当你创建一个实例时:

public class Demo {
    public static void main(String[] args) {
        Tv tv = new Logitech();
        tv.  //here when we click the . we expect to see only the startTv() 
             //method, as the type of our reference is Tv
    }
}
Run Code Online (Sandbox Code Playgroud)

然而显示的是:

我的 …

java intellij-idea

2
推荐指数
1
解决办法
106
查看次数

标签 统计

intellij-idea ×1

java ×1