问答详情
源自:7-8 Java 中的方法内部类

没有显示错误,但是运行不了

public class Outer {

private String name= "你好!";

public void show() {

class Inner{

int year=2018;

public int newYear() {

return year+1;

}

}

Inner i=new Inner();

int newyear=i.newYear();

System.out.println(name +newyear);

}

public static void main(String[] args) {

Outer o=new Outer();

o.show();

}


}

运行后是这样的

Error occurred during initialization of boot layer

java.lang.module.FindException: Error reading module: C:\Users\Administrator\Workspaces\MyEclipse CI\Lei\bin

Caused by: java.lang.module.InvalidModuleDescriptorException: Outer$1Inner.class found in top-level directory (unnamed package not allowed in module)

几个意思?


提问者:weibo_慕设计2421235 2018-11-25 18:19

个回答

  • 慕少1584939
    2018-11-25 22:59:26
    已采纳

    是因为包名的问题吗?  在前边指定个包名试试