简体   繁体   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.");
}   

Can't seem to catch where I missed it. 似乎找不到我错过的地方。 Thanks for the help in advance. 我在这里先向您的帮助表示感谢。

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);“岁。”);

^the line that seems to be the problem ^似乎是问题的线

Change the line 换线

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.");

to

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" . The ; was the problem. Use + the concatenation was not proper. "+(age*7);" years old";是问题所在。使用+串联不正确。

You are using ; 您正在使用 after (age*7) . 之后(age*7) Remove it and add + , it should work 删除它并添加+ ,它应该可以工作

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

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