java - Illegal combination of modifiers: public and private -
i having issue following code...
/** * class holds of information pertaining * person's name. */ public class name { private string first, middle, last, maiden, initials, prefix, suffix; private char middleinitial, firstinitial, lastinitial; private /** * constructor name given first, middle, , 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; }
there more error coming in primary constructor. giving me error have entered in title. can see, both class , constructor both public. shouldn't cause issues seems doing so.
you have "orphan" private
modifier before constructor's comment:
private // here! /** * constructor name given first, middle, , last names. */ public name(string first, string middle, string last) {
just remove it, , should fine.
Comments
Post a Comment