Java Language Fundamentals Flashcards
7 cards from real 1Z0-811 practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Java Language Fundamentals flashcards as text
What is the range of a Java 'byte' data type?
Answer: -128 to 127
The byte type is an 8-bit signed integer with a range of -128 to 127.
What is the output of the following? int a = 10; int b = 3; System.out.println(a % b);
Answer: 1
The % operator returns the remainder; 10 divided by 3 is 3 with a remainder of 1.
Which statement about 'var' in Java 11 is correct?
Answer: var can be used for local variable type inference
In Java 10+, 'var' enables local variable type inference, allowing the compiler to infer the type from the initializer.
What happens when you compare two String objects using == in Java?
Answer: It compares their memory references
The == operator on objects compares references, not content; use .equals() to compare String content.
What is the result of the expression: (int) 9.99?
Answer: 9
Casting a double to int truncates (not rounds) the decimal part, so (int)9.99 yields 9.
Which access modifier allows access only within the same class?
Answer: private
The 'private' access modifier restricts access to only the class in which the member is declared.
What is printed by this code? for (int i = 0; i < 3; i++) { if (i == 1) continue; System.out.print(i + " "); }
Answer: 0 2
The 'continue' statement skips the current iteration when i==1, so only 0 and 2 are printed.