当前位置: 技术问答>java相关
菜鸟问题--怎么引用这个变量?
来源: 互联网 发布时间:2015-06-17
本文导语: result res; String last; while(res.next()) last=res.getString("ColumnName"); pstmt.setString(1,last); ///出错行 出错显示: Error #: 553 : variable last might not have been initialized at line 998, column 28 怎么在while体外引用last变量? ...
result res;
String last;
while(res.next())
last=res.getString("ColumnName");
pstmt.setString(1,last); ///出错行
出错显示: Error #: 553 : variable last might not have been initialized at line 998, column 28
怎么在while体外引用last变量?
String last;
while(res.next())
last=res.getString("ColumnName");
pstmt.setString(1,last); ///出错行
出错显示: Error #: 553 : variable last might not have been initialized at line 998, column 28
怎么在while体外引用last变量?
|
String last="";
|
对!
result res;
String last;
while(res.next())
last=res.getString("ColumnName");
pstmt.setString(1,last); ///出错行
如果while不成立,那么也就是
String last;
pstmt.setString(1,last);
当然会出现错误了!
改为:
result res;
String last = "";
while(res.next())
last=res.getString("ColumnName");
pstmt.setString(1,last); ///出错行
result res;
String last;
while(res.next())
last=res.getString("ColumnName");
pstmt.setString(1,last); ///出错行
如果while不成立,那么也就是
String last;
pstmt.setString(1,last);
当然会出现错误了!
改为:
result res;
String last = "";
while(res.next())
last=res.getString("ColumnName");
pstmt.setString(1,last); ///出错行
|
last="00000"+Integer.toString(xx)