我的这个java程序有什莫错呢?
public class SumDigits extends JavaKaraProgram
{
public void myProgram()
{
int x;
int y;
x=tools.intInput("Enter integer x:");
if(x>=100&&x<=999)
y=x/100+x%10+(x/10)%10;
else
if(x>=10&&x<100)
y=x/10+x%10;
else
if(x>=0&&x<10)
y=x;
else
tools.showMessage("Wrong entry.Try again.");
//
tools.showMessage("The result is"+y);
}
}
为什莫机器总是说the variable y may not have been initialized. ???????