Java Integer Division and Concatenation
What is printed to the console when the following code segment is executed?
public class DivisionTest {
public static void main(String[] args) {
int a = 9;
int b = 4;
System.out.println(a / b + " is the result");
}
}
A
Compilation Error
B
2 is the result
C
9/4 is the result
D
2.25 is the result
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | Ishaan.m.kurup | 1 | 1 | 0m 00s | 100 |
| #2 | sgarv2513 | 1 | 1 | 0m 00s | 100 |
| #3 | songqiuhui2012 | 1 | 1 | 0m 09s | 91 |
| #4 | sailajavadlamani33 | 1 | 2 | 0m 00s | 90 |
| #5 | chunxiangxu.cxu | 1 | 1 | 0m 12s | 88 |
| #6 | suhanakochhar006 | 1 | 1 | 0m 35s | 65 |
| #7 | cr2022108 | 1 | 4 | 1m 13s | -3 |
| #8 | y.seong2027 | 1 | 2 | 2m 18s | -48 |
| #9 | bommasam000 | 2 | 7 | 9m 17s | -407 |
Items per page:
10
1 – 9 of 9
APFIVE