Implement the method toPrimitive(). It should take a value of Boolean type and return a boolean. If the passed value is null, the result should be false.
Computer scienceProgramming languagesJavaCode organizationObject-oriented programmingClasses and objectsObjects
Wrapping classes. Boxing
Only true or false
Report a typo
Sample Input 1:
trueSample Output 1:
trueSample Input 2:
falseSample Output 2:
falseWrite a program in Java 17
class Primitive {
public static boolean toPrimitive(Boolean b) {
return true;
}
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.