Given two strings, we have to swap strings. For example, If First String = “ABC” and Second String = “abc” then after swapping First String = “abc” and Second String = “ABC”.
To swap strings in Java Programming, you have to first ask to the user to enter the two string, then make a temp variable of the same type. Now place the first string in the temp variable, then place the second string in the first, now place the temp string in the second.
Following Java Program ask to the user to enter the two strings to swap the strings, then display the result after swapping the strings:
SOURCE CODE : :
OUTPUT : :
need an explanation for this answer? contact us directly to get an explanation for this answer