2017-09-16 20 views
-1

誰も私の "if文"がここでの声明ではない理由を説明することはできますか?初めてのコーダはので、任意の助けが誰かが私の説明文が技術的に声明としてカウントされない理由を私に説明することはできますか?

import java.util.Scanner; 

public class Taxes{ 

public static void main (String [] args){ 

    double anwser1 = 0; 
    int anwser2 = 0; 
    double anwser3 = 0; 
    double anwser4 = 0; 
    double discount = 0; 
    Scanner sc = new Scanner(System.in); 

    System.out.println("Please enter your quantity"); 
    anwser1 = sc.nextDouble(); 

    if(anwser1>120)then;{ 
     discount = 0.8} 
     } 
} 
+4

と言って良いの構文であるJavaの


に存在しません。 'then'はJavaのキーワードではありません。 –

+0

'if(anwser1> 120){...}' –

+0

'then'が無視された場合、'; 'はループ本体を終了させ、次の代入を別のブロックにします。 –

答えて

2
if(anwser1>120){ 
discount = 0.8; 
} 
1

thenを高く評価し、これはで開始する、まあIf 'answer' is strictly superior to 120, set the value of discount to 0.8

if(anwser1>120){ 
    discount = 0.8; 
} 
関連する問題