Input: int = 1 Output: true Input: int = 0 Output: false
- Get the boolean value to be converted.
- Check if boolean value is true or false
- If the integer value is greater than equal to 1, set the boolean value as true.
- Else if the integer value is greater than 1, set the boolean value as false.
1 after converting into boolean = true
0 after converting into boolean = false
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.