

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to convert integer to boolean
To convert integer to boolean, firstly let us initialize an integer.
int val = 100;
Now we will declare a variable with primitive boolean. While declaration, we will initialize it with the val value comparing it with an integer using the == operator. If the value matches, the value “True” is returned, else “False” is returned.
boolean bool = (val == 100);
Let us now see the complete example displaying how to convert integer to boolean.
Example
public class Demo { public static void main(String[] args) { int val = 100; System.out.println("Integer: "+val); boolean bool = (val == 100); System.out.println("Converted to Bool: "+bool); } }
Output
Integer: 100 Converted to Bool: true
- Related Questions & Answers
- Java Program to convert boolean to integer
- Java Program to convert boolean value to Boolean
- Java Program to convert an Integer to a boolean specifying the conversion values
- Java Program to convert String to Boolean
- Java Program to convert Boolean to String
- Convert Java Boolean Primitive to Boolean object
- Java Program to convert integer to octal
- Java Program to convert integer to hexadecimal
- How to convert a Boolean to Integer in JavaScript?
- Java Program to convert from integer to String
- Java Program to convert from String to integer
- Program to convert set of Integer to Array of Integer in Java
- Java Program to convert an integer into binary
- Java Program to convert decimal integer to hexadecimal number
- Java Program to convert decimal integer to octal number
Advertisements