CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

Integer Division Then Cast

Java code walkthrough · Question 30
mediumOperators

Code

Read carefully. What does this print?
1public class Main {
2 public static void main(String[] args) {
3 int a = 5;
4 int b = 2;
5 
6 double x = a / b;
7 double y = (double) a / b;
8 
9 System.out.println(x);
10 System.out.println(y);
11 }
12}

Your answer