Lulz

Write a method that swaps the values of two variables in java.

Other urls found in this thread:

en.wikipedia.org/wiki/XOR_swap_algorithm
twitter.com/SFWRedditVideos

x =1
Y = 2
X = 2
Y = 1

Suck it nerd

r u gay lol

Yes

...

Take off the flag you Brazilian

public void swap(float input1, float input2){float temp = input1;input1 = input2;input2 = temp;}

**** COMMODORE 64 BASIC V2 **** 64K RAM SYSTEM 38911 BASIC BYTES FREEREADY.10 A=1220 B=2130 A=B:B=A

ja switch x with y va

lmaoing at u rn

you didn't ask for something that actually did anything

OP was retarded and should have said without using a third variable. And OP was retarded because he wants us to do his homework for him because he said in java when really just about any language supports this.

en.wikipedia.org/wiki/XOR_swap_algorithm

Are you only dealing with numbers?

a = 3;
b = 5;
a = a + b;
b = a - b;
a = a - b;

...

[code]section .text
global _start

_start:
mov edx,1
mov ecx,x
mov ebx,1
mov eax,4
int 0x80

mov eax,1
int 0x80

section .data
x DB '8'
y DB x[code]

section .text global _start _start: mov edx,1 mov ecx,x mov ecx,y mov ebx,1 mov eax,4 int 0x80 mov eax,1 int 0x80section .datax DB '8'y DB 'x'

fail

void swap(int a, int b) { int temp = a; a = b; b = temp;

OMFG GOOGLE

Pajeet confirmed

god all you people are retards who dont know what this problem is and couldnt be bothered to read a thread.

Nothing about using other variables to complete the task.

Fucking dead shit.

DEFINITION of 'Algebraic Method' A mathematical means of solving a pair of linear equations. Algebraic method refers to a method of solving an equation involving two or more variables where one of the variables is expressed as a function of one of the other variables.

this thread brings only one thing to my mind, and that thing is cocks

This is a classic freshman computer science problem you butthurt retard, and it is always limited to using 2 variables. It is used in part to demonstrate you understand boolean logic, in this case an exclusive or. No one gives a fuck that you can swap two variables using a third.