有誰知道爲什麼我不能追加一個字符到這個StringBuffer數組(在我的例子中),有人可以告訴我我需要怎麼做?不能追加char到一個StringBuffer二維數組
public class test {
public static void main(String args[]){
StringBuffer[][] templates = new StringBuffer[3][3];
templates[0][0].append('h');
}
}
我輸出到這個代碼是:
output: Exception in thread "main" java.lang.NullPointerException
at test.main(test.java:6)
這將幫助我這麼多,所以如果你知道的任何解決方案,請回覆此
代碼按設計工作。 –