Hi all,

this is a bit of a follow on from a previous post, but slightly different so thought a new post would be best.


i want to pass my scanner variables into an object. the following is the last scanner (Added as example), followed by the creation of a new object called person using the "Personal class"

System.out.println("Please enter your telephone (+44): ");
        long telNumber = myScanner.nextLong();


               Personal account = new Personal( forename , surname, dob , add1, add2, county,postCode, telNumber);

my error is telling me to make a constructor in the personal class, but i already have.......

public Personal(String forename, String surname, long dob, String add1, String add2, String county, long telNumber)
    {
    	this.forename = forename;
        this.surname = surname;
        this.dob = dob;
        this.add1 = add1;
        this.add2 = add2;
        this.county = county;
        this.telNumber = telNumber;

     }

Recommended Answers

All 2 Replies

Be more careful!!.
You missed the postcode. Count your arguments.

ok, ive got this fixed. it seemed to not like the "public" before the constructor name.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.