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

What is printwriter in java?

902


What is generic type?

977


What is charat ()?

891


what are the disadvantages of indexes in oracle?

2439


Why is singleton class used?

983


What are the advantages of unicode?

970


When will you define a method as static in Java?

994


Is set sorted in java?

877


Explain the usage of this with constructors?

974


Can we define static methods inside interface?

926


What are the different types of garbage collectors in java?

1051


Why do we need hashmap in java?

1028


Is alive in java?

896


What is the current version of java?

976


What is use of valueof () in java?

999