Java Test 5 – Medium–High Level

Welcome to your Java Test 5 – Medium–High Level

1. What is the result of this code?


int x = 5;
int y = ++x * 2;
System.out.println(y);

2. What is the output of this code?


String a = "Hello";
String b = new String("Hello");
System.out.println(a == b);

3. What does this code print?


int a = 4;
int b = 2;
int c = a / b + a * b;
System.out.println(c);

4. What will this code print?

5. What is the result of this code?


int[] nums = {1, 2, 3};
nums[1] = nums[2];
System.out.println(nums[1]);

6. What does this return?


Math.pow(2, 3);

7. Which of these is not a Java access modifier?

8. What is the output of this code?


int x = 7;
System.out.println(x % 2 == 0 ? "Even" : "Odd");

9. What is the role of the super keyword in Java?

10. What does this code print?


System.out.println(10 > 5 && 3 < 1);

Did you like it? Don’t keep it to yourself — share it like juicy gossip! 😏