come inlocal 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;
oooooo, thank u very very much!!!:):):)