-8

私はString str="Ram Is A Good Boy";

出力が欲しい

ボーイグッドAはラムです

このアプローチのコードを教えてください。

4

3 に答える 3

0

Not giving the direct solution but if you follow the steps below, you'll achieve what you want.

  1. split with space.
  2. print the splitted values in reverse order.

But on second thought your mirror image is wrong.

Ram Is A Good Boy | yoB dooG A sI maR

isn't that correct mirror for the given string?

于 2013-03-14T09:12:17.373 に答える
0
String str = "Ram Is A Good Boy";
String [] strArray = str.split(" ");
StringBuilder sb = new StringBuilder();
for(int i=strArray.length-1;i>-1;i--)
{
    sb.append(strArray[i]+" ");
}
System.out.println(sb.toString());
于 2013-03-14T09:12:27.153 に答える
0
String str="Ram Is A Good Boy";
String splits[] = str.split(" ");
string reverse = "";
for(int i = splits.length-1; i>=0; i--) {
    reverse += splits[i] + " ";
}
System.out.println(reverse);
于 2013-03-14T09:13:35.023 に答える