1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
public class Renverser {
/**
* @param args
*/
public static void main(String[] args)
{
// TODO Auto-generated method stub
String str2 = new String("quitter");
String chaine = "";
for (int i = 0 ; i < args.length ; i++)
{
chaine += args[i];
}
if(chaine.equals(str2))
{
System.exit(0);
}
else
{
for(int i = args.length-1; i >= 0; i--)
{
// Loop backwards through the characters in each argument
for(int j=args[i].length()-1; j>=0; j--)
{
// Print out character j of argument i.
System.out.print(args[i].charAt(j));
}
System.out.print(" ");
}
}
System.out.println("");
}
} |