Computer Science, asked by ishita3458, 1 year ago

what will be the output when:val=500int val,sum,n=550;sum=n+val>1750?400:200;System.out.println(sum);

Answers

Answered by ayush3745
0
200is the solution of your questions
Answered by AskewTronics
0

200, if the user remove the syntax error :

Explanation:

  • The above question code holds the syntax error in the first line, If the user removes the syntax error then only the above code will run.
  • Then it will print the 200 because the expression holds the conditional statement.
  • This statement firstly adds the value of n and val variable (because + and conditional have the same precedence) which will be 1050.
  • Then it will check 1050 with 1750, then the condition will give the false.
  • So the 200 will be assigned because of the condition will be false in the conditional statement, then after the ":" statement will be executed.
  • Hence 200 will be assigned on the variable sum.

Learn More :

  • Java : https://brainly.in/question/13792074
Similar questions