Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

I need help please send me reply:
Write a program "if given a string like 'HAT', the
combination's returned should be like ATH,THA,TAH in java"?

Answer Posted / sathish.pk

public static void main( String[] args )
{

/* you give any String */

String myString="HAT";

char[] characters=new char[3];

for(int i=0;i<1;i++)
{

for(int j=0;j<=2;j++)
{
/* getting each character from above string(myString)*/

characters[j]=myString.charAt(j);
}

/*print each character according to our output*/

System.out.println(characters[i+1]+""+characters[i]+""+characters[i+2]);

System.out.println(characters[i+1]+""+characters[i+2]+""+characters[i]);

System.out.println(characters[i]+""+characters[i+2]+""+characters[i+1]);

System.out.println(characters[i+2]+""+characters[i+1]+""+characters[i]);

System.out.println(characters[i+2]+""+characters[i]+""+characters[i+1]);

}


}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which method returns the length of a string?

1022


How to check if linked list contains loop in java?

882


How do you escape json?

983


What is method overriding in java ?

1173


What is java lang string?

969


What restrictions are placed on method overriding in java programming?

983


Why synchronization is important?

1010


What do you mean by collectors in java 8?

923


Why do we need array in java?

994


What is null statement?

989


What is vector capacity in java?

1068


What is the difference between jdk and jre?

1043


What is the current version of java?

1013


What is integers and example?

965


Which software is used for java programming?

1001