class School { private String name; private void zs() { System.out.println("上课"); //("上课");这里符号用中文格式了 } class Student { void shuxing(String name) //viod shuxing(String name)这里void写错了 { School.this.name=name; zs(); } } public void fw() { Student s=new Student(); s.shuxing("lisi"); //s.shuxing(lisi)这里的lisi是字符串,没有加引号 } } class T5 { public static void main(String[] args) { School sh=new School(); sh.fw(); }
}
这回是正确的了 |