CJCoding With Joseph
15per day
← Back to Question List
Java Code Walkthrough #25

Type Casting Behavior

mediumOperators

📄 Code

Read carefully — what does this print?
1public class Main {
2 public static void main(String[] args) {
3 double x = 9.7;
4 int y = (int) x;
5 System.out.println(y);
6 System.out.println((double) 5 / 2);
7 }
8}

🎯 Your Answer