Swap two strings without using any variable

 Swap two strings without using any variable
public class SwapTwoStringWithoutUsingVaraible {
public static void main(String[] args) {
String a=”delhi”;
String b=”dehradun”;
a= a+b;
b = a.substring(0,(a.length()-b.length()));
a = a.substring(b.length(),(a.length()));
System.out.println(“a = “+a);
System.out.println(“b = “+b);
}
}

 

 Related Posts:

Check a string value is Integer or not in java. (Solution).

Check ia string is hexadecimal number or not (Solution).

Generate Combination in java (Solution).

Generate permutation of string(Solution).

Reverse string in java (Solution).

Find duplicate characters with occurrences in a string(Solution).

Permutation of a number(Soluion).

Split the String in java(Solution).

Convert string into number in java(Solution).

Swap two strings without using any variable(Solution).

Get a number from a string in java(Solution).

Add Two Big Number In Java(Solution).

Expand String(Solution).

Reverse String (Solution).

Leave a Reply

Your email address will not be published. Required fields are marked *

+ 44 = 50