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); } }

12th Apr 2023, 9:32 AM
Ragini Yadav
Ragini Yadav - avatar
2 Answers
+ 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
12th Apr 2023, 9:40 AM
Yasin Rahnaward
Yasin Rahnaward - avatar
+ 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.
13th Apr 2023, 7:45 AM
Sadaam Linux
Sadaam Linux - avatar