学长学姐帮忙看看--------我的这个java程序有什莫错呢?
public class SumDigits extends JavaKaraProgram
{
public void myProgram()
{
int x;
int y;
x=tools.intInput("Enter integer x:");
if(x>=100&&x=10&&x=0&&x (more...)
come in
local variable are not implicitly initialised and use of non-initialised local variables just arise the complie error.
here when the program follow goes to tools.showMessage("Wrong entry.Try again."); y is not initialised, so there is a possibility that y is used as in tools.showMessage("The result is"+y); without initialising it.
the simplest way to solve is to change int y; to int y = 0;
here when the program follow goes to tools.showMessage("Wrong entry.Try again."); y is not initialised, so there is a possibility that y is used as in tools.showMessage("The result is"+y); without initialising it.
the simplest way to solve is to change int y; to int y = 0;