Only true or false

Report a typo

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.

Sample Input 1:

true

Sample Output 1:

true

Sample Input 2:

false

Sample Output 2:

false
Write a program in Java 17
class Primitive {
public static boolean toPrimitive(Boolean b) {
return true;
}
}
___

Create a free account to access the full topic