Java中,Syntax error on token "else",是怎么一回事?
publicclassNew{publicstaticvoidmain(String[]args){intprice=-5;intamount=-10;if(price>...
public class New {
public static void main(String[] args) {
int price = -5;
int amount = -10;
if (price > 0 && amount > 0);{
int totalCost = price * amount ;
System.out.println(totalCost);
}else{
System.out.println("price和amount的值都必须大于\"0\",否则无法计算"); 展开
public static void main(String[] args) {
int price = -5;
int amount = -10;
if (price > 0 && amount > 0);{
int totalCost = price * amount ;
System.out.println(totalCost);
}else{
System.out.println("price和amount的值都必须大于\"0\",否则无法计算"); 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询