How to return swap value

it is not accepting another RETURN
my code:
public static void main(String[] args) {

	int one = 10;
	int two = 20;
	System.out.println(one + " " + two);
	int res = swap(one, two);
	System.out.println(res);
}

public static int swap(int one, int two) {
	int temp = one;
	one = two;
	two = temp;

	return one;
	//return two;
}

you can return only one value from a function…so if you want to return a group of values from a function return an object of class from the function…
class Pair{
int one;
int two;
}
public static Pair fnc(){
//your function
}
return an object of pair class from the function…

i have not reached to that level in the course
i have done till arrays
can you tell me how to do this problem other way

if you want that your changes should persist in your main function make variables one and two as global…change the return type of you swap function from int to void and also your swap functions will not take any arg…swap function will not return any value instead it will just swap those two elements…as global variables are made in heap changes will persist
you can refer to this code:
https://ide.codingblocks.com/s/72164

Hi Nipun,
As you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.
Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.