Here you can find the source of xor(boolean a, boolean b)
Parameter | Description |
---|---|
a | a parameter |
b | a parameter |
public static boolean xor(boolean a, boolean b)
//package com.java2s; /*----------------------------------------------------------------------------- * GDSC SMLM Software/*from ww w . j a va2 s.co m*/ * * Copyright (C) 2016 Alex Herbert * Genome Damage and Stability Centre * University of Sussex, UK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. *---------------------------------------------------------------------------*/ public class Main { /** * Perform an either/or operator * * @param a * @param b * @return true if one or the other is true but not both */ public static boolean xor(boolean a, boolean b) { return (a && !b) || (b && !a); } }