大佬們看看這個(gè)問題
{
???
??? private String name = "愛慕課";
???
??? // 外部類中的show方法
??? public void show() {
??// 定義方法內(nèi)部類
??class MInner {
???int score = 83;
???public int getScore() {
????return score + 10;
???}
??}
???????
??// 創(chuàng)建方法內(nèi)部類的對象
??????? MInner mi=new MInner();
???????
??????? // 調(diào)用內(nèi)部類的方法
??int newSocre=mi.getScore();
???????
??System.out.println("姓名:" + name + "\n加分后的成績:" + newScore);
?}
???
?// 測試方法內(nèi)部類
?public static void main(String[] args) {
???????
??// 創(chuàng)建外部類的對象
??????? HelloWorld mo=new HelloWorld();
???????
??????? // 調(diào)用外部類的方法
??mo.show();
?}
}
錯誤提示是這個(gè):
/124/2096/H7Yf/HelloWorld.java:22: error: cannot find symbol
System.out.println("???" + name + "\n???????" + newScore);
??????????????????????????????????????????????? ^
? symbol:?? variable newScore
? location: class HelloWorld
2017-01-20
int newScore字母拼錯了。媽的23333333