这是我想要完成的事情
文件 1:./net/Class1.java
package net;
public class Class1
{
protected static class Nested
{
}
}
文件 2:./com/Class2.java
package com;
import net.Class1;
public class Class2 extends Class1
{
Nested nested = new Nested();
}
这是我得到的错误
>javac ./net/Class1.java ./com/Class2.java
.\com\Class2.java:7: error: Nested() has protected access in Nested
Nested nested = new Nested();
这个错误是预期的吗?难道我做错了什么?