package com.chsxt.test;
public class TestAccess {
private int i = 9;
int j = 90;
protected int k = 92;
public int kk = 80;
}
package TestCsdn;
import com.chsxt.test.TestAccess;
public class Test4 extends TestAccess{
public static void main(String[] args){
TestAccess test = new TestAccess();
test.kk = 60;
test.k = 20;//为什么会报错,在TestAccess的子类中访问父类的protect变量为什么不可以?
}
}
------解决方案--------------------
java中protected的权限