我有下面的代碼的問題...非法修飾的組合:公共和私人
/**
* This class holds all of the information pertaining to
* a person's name.
*/
public class Name {
private String first, middle, last, maiden, initials, prefix, suffix;
private char middleInitial, firstInitial, lastInitial;
private
/**
* Constructor for a Name given first, middle, and last names.
*/
public Name(String first, String middle, String last) {
this.first = first;
this.middle = middle;
this.last = last;
this.middleInitial = middle.charAt(0);
this.firstInitial = first.charAt(0);
this.lastInitial = last.charAt(0);
this.initials = String.valueOf(firstInitial + middleInitial
+ lastInitial);
this.maiden = null;
this.prefix = null;
this.suffix = null;
}
還有更多,但我的錯誤是在我的主構造的到來。它給了我在標題中輸入的錯誤。正如你所看到的,我的課程和構造函數都是公開的。這不應該導致任何問題,但似乎這樣做。
哇,謝謝。今天看代碼太久了。小事情開始讓我受益。謝謝 –
這就是爲什麼最好在單獨的行上列出每個班級成員。 – MaxZoom
@MaxZoom即使我同意在單獨行上的列表看起來更好,但我不明白如何在單獨行上列出來避免該問題 –