How to swap two strings without using a third variable in java / Various methods to swap two strings without additional variable
Swapping strings Swapping two strings means interchanging their values with one another. Example, there are two string variables s1 and s2 with values s1 = “codippa.com” and s2 = “the website”, Swapping the two strings will make their value as s1 = “the website” and s2 = “codippa.com” Common Approach The most common approach of swapping two strings is to store the value of one of the strings into a temporary variable and then assigning the value of second string to first one. Finally, assigning the value of temporary variable back to the first string as shown below String s1 = “codippa.com”; String s2 =Read More →