Click to reveal answer.
A primitive data type.
Click to reveal answer.
An object wrapper class.
Click to reveal answer.
On the **stack**. If its a local variable inside a method. In the heap if its a class field
Click to reveal answer.
On the heap.
Click to reveal answer.
false
Click to reveal answer.
null
Click to reveal answer.
No.
Click to reveal answer.
Java Generics do not support primitive data types.
Click to reveal answer.
Autoboxing.
Click to reveal answer.
Unboxing.
Click to reveal answer.
Boolean.valueOf()
Click to reveal answer.
booleanValue()
Click to reveal answer.
A NullPointerException is thrown.
Click to reveal answer.
To avoid the memory overhead and GC pressure caused by creating wrapper objects.
Click to reveal answer.
Boolean.TRUE.equals(variable)
Click to reveal answer.
1 bit.
Click to reveal answer.
It includes an object header in addition to the primitive value.
Click to reveal answer.
It skips the right-hand side if the left-hand side is false.
Click to reveal answer.
It skips the right-hand side if the left-hand side is true.
Click to reveal answer.
& evaluates both sides regardless of the first value (no short-circuiting).
Click to reveal answer.
| evaluates both sides regardless of the first value (no short-circuiting).
Click to reveal answer.
false
Click to reveal answer.
The XOR operator (^).
Click to reveal answer.
false
Click to reveal answer.
== compares memory references, while .equals() compares logical values.
Click to reveal answer.
boolean is a primitive data type, while Boolean is an object wrapper class.
Click to reveal answer.
false
Click to reveal answer.
null
Click to reveal answer.
It is stored on the heap and includes an object header plus the internal primitive value.
Click to reveal answer.
Java Generics do not support primitives; they require **object types** like Boolean.
Click to reveal answer.
A **compilation error** (primitives do not have methods).
Click to reveal answer.
It automatically converts the primitive boolean to a Boolean object using Boolean.valueOf().
Click to reveal answer.
It extracts the primitive value by automatically calling the booleanValue() method.
What is the "Hidden Danger" of unboxing a Boolean object that is null?
Click to reveal answer.
It throws a NullPointerException (NPE) because the compiler tries to call .booleanValue() on a null reference.
Click to reveal answer.
It causes performance degradation due to constant object creation and increased Garbage Collection pressure.
Click to reveal answer.
The == operator compares memory references (addresses) rather than logical values.
Click to reveal answer.
Use Boolean.TRUE.equals(yourObject).
Click to reveal answer.
It skips evaluation of the right operand because the overall result is guaranteed to be false.
Click to reveal answer.
It skips evaluation of the right operand because the overall result is guaranteed to be true.
Click to reveal answer.
To perform a null check before accessing a member: if (user != null && user.isActive()).
Click to reveal answer.
&& is short-circuiting, while & forces evaluation of both sides regardless of the first result.
Click to reveal answer.
It returns true only if the two inputs are different (one true, one false).
Click to reveal answer.
false
Click to reveal answer.
It flips the value (e.g., !true becomes false).
Click to reveal answer.
An object header in Java is a small block of metadata stored at the beginning of every object in heap memory. It serves as the runtime identity card for the object, allowing the Java Virtual Machine (JVM) to perform memory management, garbage collection, and synchronization.
Click to reveal answer.
In the Metaspace (part of the class metadata), rather than within individual heap objects.
Click to reveal answer.
Exactly one copy, shared by all instances.
Click to reveal answer.
It cannot access instance fields or instance methods because it lacks a this parameter.
Click to reveal answer.
Because static members belong to the class itself and are initialized when the class is loaded.
Click to reveal answer.
It ensures the variable can be assigned only once; its value becomes a constant.
Click to reveal answer.
It prevents any subclass from overriding that specific method.
One of the challenges of developing concurrent programs in Java is the mismatch between the concurrency features offered by the platform and how developers need to think about concurrency in their programs.
Threads are the easiest way to tap the computing power of multiprocessor systems. As processor counts increase exploiting concurrency effectively will only become more important.
