【求助】这段java代码哪里错了?
//用记事本编写程序,求1+2*2+3*3 +...+n*n的值。n的值从键盘输入,import *;
public class MyApplication3{
public static void main(String args[])
{
int n;
int sum=0;
System.out.print("Enter a number please:");
try{
n=(int)System.in.read();
sum=0;
for(int i=1;i<=n;i++)
{
sum=sum+i*i;
}
}catch(IOException e){};
System.out.println("The answer is"+ sum);
}
}