DeveloperBreeze

Swap Two Numbers Without Using a Temporary Variable

int a = 5, b = 10;

a = a + b;
b = a - b;
a = a - b;

System.out.println("a = " + a + ", b = " + b);

Continue Reading

Handpicked posts just for you — based on your current read.

Discussion 0

Please sign in to join the discussion.

No comments yet. Start the discussion!