Eclipse gives me this error message: The literal [number] of type int is out of range. I know that's impossible to define an int with a number which is higher than 2147483647 or lower than -2147483647. The numbers which I want to set as an int are mobile phone numbers (in Switzerland they can have maximum the value of 0999999999 - Isn't this already enough low to define it as an int??). I changed the variable type of the attributes date and number in the class Person to long. Now I receive the error message which I mentionned above. Why? How can I fix this?
Thank you.
Here is my code:
public class PhoneBook {
public static void main(String[] args) {
Person sister = new Person ();
Person brother = new Person();
Person mother = new Person();
Person father = new Person();
mother.name = "Gertrud";
mother.date = 12041969;
mother.number = 0792467286;
sister.name = "Theresa";
sister.date = 02112002;
sister.number = 0794567843;
brother.name = "Megnitz";
brother.date = 01041999;
brother.number = 0775685421;
father.name = "Randolph";
father.date = 21071966;
father.number = 0764532178;
}
}
___________________________________________________________________________________________________
public class Person {
String name;
long date;
long number;
public void print() {
System.out.println(name + ", " + "born on " + date + " / " + number);
}
}