come in
登录 | 论坛导航 -> 华新鲜事 -> 社会百科 | 本帖共有 1 楼,分 1 页, 当前显示第 1 页 : 本帖树形列表 : 刷新 : 返回上一页
<<始页  [1]  末页>>
作者:想念老乡 (等级:2 - 初出茅庐,发帖:160) 发表:2003-08-26 23:49:08  楼主  关注此帖评分:
学长学姐帮忙看看--------我的这个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;
Put your OWN COOL signature here!
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版所有回复从这里展开收起列表
论坛导航 -> 华新鲜事 -> 社会百科 | 返回上一页 | 本主题共有 1 篇文章,分 1 页, 当前显示第 1 页 | 回到顶部
<<始页  [1]  末页>>

请登录后回复:帐号   密码