Java Associate — Easy
Explanation
To declare a variable of type integer in Java, you use the keyword "int" followed by the variable name. Therefore, the correct way is: int x = 5;
Ready to go further?
Related questions
- Which of the following is NOT a primitive data type in Java?
- What is the output of the following code? ```java int x = 5; System.out.println(x++); ```
- What is the difference between `HashMap` and `Hashtable` in Java?
- What does the `static` keyword mean when applied to a method?
- What does the `//` symbol represent in Java?
- What is the difference between `ReentrantLock` and the `synchronized` keyword in Java?
