繁体   English   中英

Netbeans Ide')'预期

[英]Netbeans Ide ')' expected

private void btnUserActionPerformed(java.awt.event.ActionEvent evt) {                                        
   String strName,strFood,strAge; 
   strName=this.txtDogsname.getText();
   strFood=this.txtDogsfood.getText();
   int age= Integer.parseInt(txtDogsage.getText());
   //Changes string to int
   this.lbloutput.setText("The Dog's name is "+strName+". "+ strName+"'s favourite food is "+ strFood+". "+strName+"'s Age in human years is"+(age*7);" years old.");
}   

似乎找不到我错过的地方。 我在这里先向您的帮助表示感谢。

this.lbloutput.setText(“狗的名字是” + strName +“。” + strName +“的最爱食物是” + strFood +“。” + strName +“的人类年龄是” +(年龄* 7);“岁。”);

^似乎是问题的线

换线

this.lbloutput.setText("The Dog's name is "+strName+". "+ strName+"'s favourite food is "+ strFood+". "+strName+"'s Age in human years is"+(age*7);" years old.");

this.lbloutput.setText("The Dog's name is "+strName+". "+ strName+"'s favourite food is "+ strFood+". "+strName+"'s Age in human years is"+(age*7)+" years old.");

"+(age*7);" years old" "+(age*7);" years old";是问题所在。使用+串联不正确。

您正在使用 之后(age*7) 删除它并添加+ ,它应该可以工作

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM