2013-07-24 81 views
-3

所以我正在使用Eclipse为学校做一个项目。我一直对令牌“+”收到语法错误,++期望。语法错误++预期?

System.out.print ("End of Supplier transactions"); 
calcsuppliersummary(); 
System.out.print("The total interest of"+name+"is:" +interest+); 
System.out.print("The supplier Ending Balance is:"+endbal+); 
} 

该错误出现在System.out.print行。

+7

删除+结束。 – kosa

+0

具体来说,删除利息和endbal结尾处的+。 –

回答

1

interestendbal末尾的+会使编译器认为之后会添加某些内容。如果这是您想要打印的结尾,则最后不需要+。就像你不会写2 + 2 + = 4(但你会写2 + 2 = 4),你会写"The supplier Ending Balance is:"+endbal而不是"The supplier Ending Balance is:"+endbal+

希望这会有所帮助!

顺便说一下,你是新来的Java?如果是这样,那里有一些非常好的书,这使得它很容易学习:)。

+0

太棒了。谢谢,这很好。是的,我刚刚接触java,目前正在尝试使用与课程一起发布的教科书,而这本书几乎没有任何内容。你有什么书你可以推荐?我目前只是使用oracle网站。 – user2612845

+0

对不起,我其实关注C#,但我认为一个快速的亚马逊或eBay(甚至Youtube)搜索Java教程将极大地帮助。 – BalinKingOfMoria

相关问题