Java Test 2 – Easy Level

Welcome to your Java Test 2 – Easy Level

1. Which operator is used to compare two values for equality in Java?

2. Which loop is guaranteed to execute at least once?

3. Which of the following is a correct array declaration in Java?

4. What is the result of this code?


int x = 5;
x += 3;
System.out.println(x);

5. What is the output of this code?


String name = "Ana";
System.out.println("Hello " + name);

6. What is the value of result after this code runs?


int a = 10;
int b = 3;
int result = a % b;

7. Which method converts a string to an integer in Java?

8. What does this return?


System.out.println("Java".length());

9. Which of the following declares a constant in Java?

10. What is printed by this code?


boolean isJavaFun = true;
System.out.println(!isJavaFun);

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