0 votes
in JAVA by
How to swap two strings in java?

1 Answer

0 votes
by

How to swap two strings in java?

String a = ""one"";

String b = ""two"";

a = a + b;

b = a.substring(0, (a.length() - b.length()));

a = a.substring(b.length());

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

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

🔗Reference: stackoverflow.com

🔗Source: Java Interview Questions and Answers

Related questions

+1 vote
asked Oct 13, 2020 in JAVA by SakshiSharma
+1 vote
asked May 31, 2020 in JAVA by SakshiSharma
...