0
what will be output came in the code snippets...how,why, also explain
public class Program { public static void main(String[] args) { System.out.println(4/3*43); } }
2 odpowiedzi
+ 4
ragini yadav
Here is the operator priority.
(/) (*) (%) operator have the equal priority from left to right.
4/3*43 here in the first step 4/3 is executes which is equal to 1, then the result will multiply with 43.
4/3=1
1*43=43
+ 3
The expression 4/3 will perform integer division, resulting in a quotient of 1 and no remainder. Therefore, the expression 4/3*43 will be evaluated as (1)*43 which equals to 43.