I am having an issue with the following code...
/**
* 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;
}
There is more but my error is coming in my primary constructor. It is giving me the error that I have entered in the title. As you can see, both my class and constructor are both public. This shouldn't cause any issues but seems to be doing so.
You have an "orphan" private
modifier before the constructor's comment:
private // Here!
/**
* Constructor for a Name given first, middle, and last names.
*/
public Name(String first, String middle, String last) {
Just remove it, and you should be fine.