Hi all,

I have a constructor with 2 numbers both set as longs

however

in my driver class, it is showing as an error, even after casting the already longs to a long again.

This is constructor

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;

     }

And this is the line of code giving the "number too big for int" error

personalList[0] = new Personal("Paul "," White ", 074078L , "51 Princes Street", "North Shields", "Tyne and Wear", 7852384379L);

note the two numbers are cast as long, the error occurs with/without casting.

Cheers

Paul

Where are the declarations of dob and telnumber (the instance variables, not the parameters)?

Edited 7 Years Ago by JamesCherrill: n/a

they are in the same class as "public personal"

private long dob;
private long telNumber;

public long getDob()
{
return dob;
}
public long getTelNumber()
{
return telNumber;
}

Edited 3 Years Ago by Reverend Jim: Fixed formatting

I think you need to remove the '0' from the first number:

personalList[0] = new Personal("Paul "," White ", [B]0[/B]74078L , "51 Princes Street", "North Shields", "Tyne and Wear", 7852384379L);
This question has already been answered. Start a new discussion instead.