int age = 17;
boolean hasLicense = true;
if (age >= 16 && hasLicense) {
System.out.println("can drive");
} else {
System.out.println("cannot drive");
}What is printed?
- A
true
- B
false
- C
cannot drive
- Dcheck_circle
can drive
Explanation
Both conditions are true: age >= 16 (17 >= 16) and hasLicense (true). The && evaluates to true, printing "can drive".