Test4:
package com.winsunlight;
public class Test4{
protected void weather(){
System.out.println("today is rainy!");
}
}
Test3:
package cn.mybole;
import com.winsunlight.Test4;
class Test3{
public static void main(String args[]){
Test4 t4=new Test4();
t4.weather();
}
}
系统提示不能在com.winsunlight.Test4中访问 t4.weather()
不好意思写错了 我说的是protected 方法 结果写成了private