TestingDocs.com
    Software Testing website
    • Automation
      • Selenium
      • JBehave Framework
    • Tutorials
      • MySQL Tutorials
      • Testlink
      • Maven
      • Git
    • IDEs
      • IntelliJ IDEA
      • Eclipse
    • Flowcharts
      • Flowgorithm
      • Raptor
    • About

    Java Tutorials

    Java Exclusive OR Operator

    Overview

    In this tutorial, we will learn about Java Exclusive OR operator with a simple java program. The Exclusive OR( XOR ) operator produces 1 where the bits in its operands are different and produces 0 if they are the same. The (^) is the exclusive OR operation symbol.

    Table

    Outcome table with the Bitwise Exclusive OR operator

    Operand: A Operand: B  Exclusive OR : A ^ B
    0 0 0
    0 1 1
    1 0 1
    1 1 0

    Sample Program

    /
    * 
     * Java Program to demonstrate 
     * Bitwise Exclusive OR(XOR) Operator.
     * Java Tutorials -- www.TestingDocs.com 
     */
    public class BitwiseExclusiveORDemo {
     public static void main(String args[])
     {
     //Declare two variables
     int A = 1;
     int B = 0; 
     System.out.println("A ^ B =: " + (A ^ B));
     A = 0;
     B = 0;
     System.out.println("A ^ B =: " + (A ^ B));
     }
    }

    Program Output

    A ^ B =: 1
    A ^ B =: 0
    —

    Java Tutorials

    Java Tutorial on this website:

    https://www.testingdocs.com/java-tutorial/

    For more information on Java, visit the official website :

    https://www.oracle.com/java/

    Related Posts

    Java Performance

    Java Tutorials /

    Improving Java Performance with Multithreading

    Download Greenfoot Windows

    Java Tutorials /

    Download & Install Greenfoot on Windows

    Java Tutorials /

    Java Static Code Analysis

    Java Tutorials /

    Java Testing Tools

    Java Tutorials /

    Handle Multiple Exceptions in Java

    ‹ Java Bitwise OR operator› Armstrong Number Java Program

    Recent Posts

    • ChatGPT Plans Free and PlusChatGPT Subscription Plans
    • Stellar Converter for Database ToolStellar Converter for Database
    • Stellar MySQL Log AnalyzerStellar Log Analyzer for MySQL
    • Stellar Repair for MySQLStellar Repair for MySQL
    • ChatGPT IntroductionChatGPT Capabilities
    • How to secure your SQL Database: Tips and Tricks
    • ChatGPT4 Conversational AI FeaturesChatGPT4 Conversational AI Features
    • Trends in Software EngineeringShaping the Future of Development: Exploring Key Trends in Software Engineering
    • Java PerformanceImproving Java Performance with Multithreading
    • QDrant Vector DatabaseOpen-source Vector Databases
    • Difference between PHP and JavaScript?
    • Bing AI Browser Web ContentBing Conversation Styles
    • ChatGPT PreviewChatGPT Introduction
    • Open Source AI Frameworks TensorFlowOpen Source AI Frameworks
    • Artificial Intelligence Tools

    Back to Top

    Links

    • Contact
    • Privacy Policy
    • Cookie Policy

    www.TestingDocs.com