memesearch
Arithmetic Exception Equality Check

Arithmetic Exception Equality Check

Download Find similar pictures
Text on the meme
public static boolean isEqual(int a, int b) { try { int c = 1 / (a - b); } catch (ArithmeticException e) { return true; } return false; }
What it means

A Java method checks whether two integers are equal by dividing 1 by their difference. When the numbers are equal, the division causes an ArithmeticException, so the catch block returns true; otherwise it returns false. The joke is the absurdly indirect and overcomplicated way of implementing a simple equality check, making it a reaction for bad code or cursed programming logic.

Objects
Tags
Sources
Type
image
Size
429×213 · 15.3 KiB
Mood
absurd, sarcastic
Language
en
Added