20+ practice questions focused on Java Basics and Syntax — one of the most tested topics on the Oracle Java Foundations 1Z0-811 exam. Each question includes a detailed explanation so you learn why the right answer is correct.
Start Java Basics and Syntax PracticeWhich code snippets correctly create a two-dimensional array with 3 rows and 4 columns? (Select all that apply)
Explanation: Options B and D are both correct. In Java, a two-dimensional array can be declared using either `int[][] array = new int[3][4];` (Option D) or `int[] array[] = new int[3][4];` (Option B). Both syntaxes are valid and create a 3x4 array. Options A and C are incorrect because Java does not use commas to separate dimensions; each dimension must be in its own set of brackets.
Which FOUR statements about the main method are correct? (Choose four.)
Explanation: Options A, B, and C are correct because the main method must be declared void, static, and public for the JVM to invoke it as the entry point of a program. Option E is also correct: Java allows overloading of the main method; you can define multiple main methods with different parameter lists, but only the one with the standard signature `public static void main(String[] args)` is used as the program entry point. Option D is incorrect because the main method must not return a value; its return type must be void.
A developer needs to declare a constant for the value of PI (3.14159) in a class. Which declaration follows Java best practices?
Explanation: The best choice because Java best practices for constants require the use of the `public static final` modifiers to create a class-level constant. While the naming convention recommends uppercase names (e.g., `PI`), the presence of `public static final` is more critical for a constant to be accessible and immutable across the class. Option A lacks `public` and `static`, making it an instance constant rather than a class constant, which does not follow best practices. Therefore, among the given choices, Option C is the most appropriate.
Which THREE are valid Java identifiers? (Choose three.)
Explanation: Options A, D, and E are valid Java identifiers. Java identifiers must start with a letter (a-z, A-Z), underscore (_), or dollar sign ($). Subsequent characters can include letters, digits, underscores, or dollar signs. Option A ($dollar) starts with $, valid. Option D (_value) starts with _, valid. Option E (myVar123) starts with a letter and contains digits, valid. Option B (my var) contains a space, invalid. Option C (2ndValue) starts with a digit, invalid.
A class has two methods: void setValue(int a) and void setValue(double a). Which call will result in a compilation error?
Explanation: Since the class contains both overloaded methods void setValue(int a) and void setValue(double a), all the provided calls are valid and compile without error. setValue(5) calls the int version, setValue(5.0) calls the double version, and setValue((int)5.0) explicitly casts to int, calling the int version. Option B consists of two separate valid calls within the same class, so no compilation error occurs. Therefore, none of the options result in a compilation error.
+15 more Java Basics and Syntax questions available
Practice all Java Basics and Syntax questions1. Baseline your knowledge
Start with 10 questions to gauge your current understanding of Java Basics and Syntax. This tells you whether you need a concept refresher or just practice.
2. Review every explanation
For each question — right or wrong — read the full explanation. Understanding why an answer is correct is more valuable than knowing the answer itself.
3. Focus on exam traps
Java Basics and Syntax questions on the 1Z0-811 frequently use trap wording. Look for subtle differences in answers that test your precision, not just general knowledge.
4. Reach 80% consistently
Do repeated sessions until you score 80%+ three times in a row. Then move to mixed-mode practice to test cross-topic recall under realistic conditions.
The exact number varies per candidate. Java Basics and Syntax is tested as part of the Oracle Java Foundations 1Z0-811 blueprint. Practicing with targeted Java Basics and Syntax questions ensures you can handle any format or difficulty that appears.
Yes. Courseiva provides free 1Z0-811 practice questions across all exam topics and domains. The platform includes topic-based practice, mock exams, missed-question review, bookmarked questions, and readiness tracking — no account required.
Difficulty is subjective, but Java Basics and Syntax is a high-priority exam concept tested in multiple ways — direct recall, scenario analysis, and command-output interpretation. Consistent practice is the best way to build confidence.
Launch a full Java Basics and Syntax practice session with instant scoring and detailed explanations.
Start Java Basics and Syntax Practice →