Hello,
I want to swap two string in JAVA without built-in function like this.
How can I fix it?
Thanks
import java.util.*; public class MainClass { public static void Swap(String myString, String yourString) { String S = myString; myString = yourString; yourString = S; } public static void main(String[] args) { Scanner S = new Scanner(System.in); String Str = S.nextLine(); String Str2 = S.nextLine(); Swap(Str,Str2); System.out.printf("My String %s \n",Str); System.out.printf("Your String %s \n",Str2); } }