WorksheetsData Types
Total questions: 10
Worksheet time: 4mins
int x = 10;
System.out.println(x / 3);
3
3.33
3.0
Compilation error
double y = 10 / 3;
System.out.println(y);
3.33
3
3.0
Compilation error
char letter = 'A' + 1;
System.out.println(letter);
A
B
66
Compilation error
boolean result = (5 > 3) && (2 < 1);
System.out.println(result);
true
false
Runtime error
Compilation error
float f = 5.5;
System.out.println(f);
5.5
5
Runtime error
Compilation error
System.out.println("10" + 5);
105
15
10 + 5
Compilation error
long l = 1000 * 1000 * 1000 * 1000;
System.out.println(l);
1 000 000 000 000
Overflow, incorrect result
Runtime error
Compilation error
Output:
25.0
System.out.println(5 * 5 );
System.out.println(5 * 5.0);
System.out.println((int) (5 * 5.0));
System.out.println((double) 5 * 5);
Output:
3.14159
System.out.println(3.14159);
System.out.println("%.5f", 3.14159);
System.out.println((double) 3.14159);
System.out.println("3.14159");
Output:
"Java 101"
System.out.println("Java " + 101);
System.out.println("Java " + "101");
System.out.println(101 + " Java");
