所以我只是玩弄一些我學到的東西,做出一些毫無意義的計算器。之前有人說,我知道這可以做得更簡單!「第一種類型的int,第二種類型的布爾值」java
我對我的發言時,雖然得到這個錯誤(錯誤的操作類型的二元運算符「||」第一種類型:INT,第二種類型:布爾「)
它也拋出的問題與
int AA = A + B;
int AB = A * B;
int AC = A/B;
說找不到符號
class cases{ //1-4 sums with cases, delete after//
public static void main(String args[]){
System.out.println("Welcome to a pointless calculator.");
int A = Integer.parseInt(args[0]);
int B = Integer.parseInt(args[1]);
switch (A){
case 1:
System.out.print("You entered 1");
break;
case 2:
System.out.print("You entered 2");
break;
case 3:
System.out.print("You entered 3");
break;
case 4:
System.out.print("You entered 4");
}
while (A || B > 4){
System.out.print("please enter numbers 1-4");
break;
}
switch (B) {
case 1:
System.out.println(" and 1");
break;
case 2:
System.out.println(" and 2");
break;
case 3:
System.out.println(" and 3");
break;
case 4:
System.out.println(" and 4");
}
}
{
int AA = A + B;
int AB = A * B;
int AC = A/B;
System.out.print("the answers added = ");
System.out.println(AA);
System.out.print("the answers multipled = ");
System.out.println(AB);
System.out.print("the answers divided = ");
System.out.println(AC);
}
}
謝謝 - 現在我所面臨的額外問題是,它不會在有效的arg條目中打印out.prints。 – user2992500