Long 类型变量中的整数太大
Integer number too large in Long type variable
我尝试声明用于测试的固定数组对象,以消除在每个 运行.
上重新输入对象的需要
数组测试对象是这样的:
studentList[0].setStudent("Mr", "Jason", "Lee", 00001, 01, 01,2001, 85, 75, 8, 65, 72.5, "D");
studentList[1].setStudent("Miss", "Candice", "Teo", 00002, 02, 02, 2002, 95, 95, 9, 90, 92.0, "HD");
studentList[2].setStudent("Mrs", "Sophie", "Chua", 00003, 03, 03, 2003, 65, 78, 7, 92, 81.6, "HD");
studentList[3].setStudent("Mrs", "Brendon", "Low", 00004, 04, 04, 2004, 95, 98, 7, 69, 80.1, "HD");
studentList[4].setStudent("Mr", "Clarance", "Yeo", 00005, 05, 05, 2005, 80, 76, 5, 59, 65.7, "C");
studentList[5].setStudent("Mr", "Adrian", "Tan", 00006, 06, 06, 2006, 70, 60, 4, 20, 40.0, "ND");
studentList[6].setStudent("Ms", "Debbie", "Toh", 00007, 07, 07, 2007, 60, 60, 7, 50, 56.0, "P");
studentList[7].setStudent("Miss", "Sarah", "Ho", 00008, 08, 08, 2008, 59, 61, 7, 62, 62.0, "N");
studentList[8].setStudent("Mr", "Aloysius", "Lim", 00009, 09, 09, 2009, 62, 63, 8, 69, 67.5, "C");
studentList[9].setStudent("Mrs", "Peggy", "Lo", 00010, 10, 10, 2010, 65, 67, 9, 72, 71.4, "D");
它们是一个包含
的数组对象
studentTitle
(字符串),
studentFirstName
(字符串),
studentLastName
(字符串),
studentID
(长),
其余的是 (Int) 的分数,最后是 (String) 的 grade
。
但是,显示了一条错误消息:
integer number too large: 00008
integer number too large: 08
integer number too large: 08
对于 studentList[7]
和 studentList[8]
。
我可以知道应该更正什么吗?谢谢
08
和00008
被解析为八进制数,其中8和9是无效数字。删除前导零。
我尝试声明用于测试的固定数组对象,以消除在每个 运行.
上重新输入对象的需要数组测试对象是这样的:
studentList[0].setStudent("Mr", "Jason", "Lee", 00001, 01, 01,2001, 85, 75, 8, 65, 72.5, "D");
studentList[1].setStudent("Miss", "Candice", "Teo", 00002, 02, 02, 2002, 95, 95, 9, 90, 92.0, "HD");
studentList[2].setStudent("Mrs", "Sophie", "Chua", 00003, 03, 03, 2003, 65, 78, 7, 92, 81.6, "HD");
studentList[3].setStudent("Mrs", "Brendon", "Low", 00004, 04, 04, 2004, 95, 98, 7, 69, 80.1, "HD");
studentList[4].setStudent("Mr", "Clarance", "Yeo", 00005, 05, 05, 2005, 80, 76, 5, 59, 65.7, "C");
studentList[5].setStudent("Mr", "Adrian", "Tan", 00006, 06, 06, 2006, 70, 60, 4, 20, 40.0, "ND");
studentList[6].setStudent("Ms", "Debbie", "Toh", 00007, 07, 07, 2007, 60, 60, 7, 50, 56.0, "P");
studentList[7].setStudent("Miss", "Sarah", "Ho", 00008, 08, 08, 2008, 59, 61, 7, 62, 62.0, "N");
studentList[8].setStudent("Mr", "Aloysius", "Lim", 00009, 09, 09, 2009, 62, 63, 8, 69, 67.5, "C");
studentList[9].setStudent("Mrs", "Peggy", "Lo", 00010, 10, 10, 2010, 65, 67, 9, 72, 71.4, "D");
它们是一个包含
的数组对象studentTitle
(字符串),
studentFirstName
(字符串),
studentLastName
(字符串),
studentID
(长),
其余的是 (Int) 的分数,最后是 (String) 的 grade
。
但是,显示了一条错误消息:
integer number too large: 00008
integer number too large: 08
integer number too large: 08
对于 studentList[7]
和 studentList[8]
。
我可以知道应该更正什么吗?谢谢
08
和00008
被解析为八进制数,其中8和9是无效数字。删除前导零。