- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 perform an XOR on a set of Booleans
To perform XOR on a set of Booleans, firstly let us consider the following Boolean array.
boolean[] arr = { true, true, false };
Let us now create a nested loop and within that perform XOR operation.
for (boolean one : arr) { for (boolean two: arr) { // XOR boolean res = one ^ two; } }
Here is the entire example to displayXOR on a set of Booleans.
Example
public class Demo { public static void main(String[] args) { // boolean array boolean[] arr = { true, true, false }; for (boolean one : arr) { for (boolean two: arr) { // XOR boolean res = one ^ two; System.out.println(res); } } } }
Output
false false true false false true true true false
- Related Articles
- Java Program to perform XOR operation on BigInteger
- Program to perform XOR operation in an array using Python
- How to perform Bitwise XOR operation on two images using Java OpenCV?
- Java Program to perform AND operation on BigInteger
- How to perform bitwise XOR operation on images in OpenCV Python?
- Booleans Class in Java
- How to perform heapsort on an array in Java?
- Java program to convert a Set to an array
- How to perform binary search on an array in java?
- Java Program to convert a set into an Array
- Java program to convert an Array to Set
- Java Program to Perform nCr (rcombinations)
- Java Program to set an icon for JOptionPane
- Java program to swap two numbers using XOR operator
- Java Program to set a spinner of dates in Java

Advertisements