Reputation: 1
I'm having trouble implementing my sub class Customer I am getting the error 58 expected: "number="";" I am trying to get the customer class to inherit the methods in my Person class.
my program so far:
import java.util.Scanner;
public class Person
{
private String name;
private String address;
private String number;
public Person() //No Argument constructor//
{
name= "";
address= "";
number= "" ;
}
public Person(String num, String nam, String add) //Explicit value constructor//
{
number= num;
name= nam;
address= add;
}
public String getName() //Accessor method//
{
return name;
}
public void setName(String name )//Mutator method//
{
this.name= name;
}
public String getAddress()
{
return address;
}
public void setAddress(String address)
{
this.address= address;
}
public String getTelephoneNumber()
{
return number;
}
public void setNumber(String number)
{
this.number= number;
}
public String toString ()
{
return name + "\n" + address + "\n" + number;
}}
public class Customer extends Person
{
number="";
public Customer(String num, String nam, String add)
{
super (number);
}
public void addChoice(String number, boolean correct)
{
choice.add(choice);
if (correct)
{
setAnswer(choiceString);
}
}
public void display()
{
super.display();
}
}
Upvotes: 0
Views: 73
Reputation: 17007
What it is is pretty simple. You accidentally put an closing brace }
instead of an opening brace {
after the declaration of getName
. Really easy to fix.
Upvotes: 2