[問題]輸入字串:Hello 輸出字串:pmmfl
class EX3
{
public static void main(String[] args)
{
String str="Hello";
System.out.println("輸入字串:"+str);
char[] cstr=str.toCharArray();
int i;
System.out.print("轉換字串:");
for(i=0;i<cstr.length;i++)
{
char c=(char)(cstr[i]+1);
System.out.print(c);
}
System.out.println();
System.out.print("輸出字串:");
for(i=4;i>=0;i--)
{
char c=(char)(cstr[i]+1);
System.out.print(c);
}
}
}
我的寫法是這樣~
可是我希望用StringBuffer的reverse方法來寫~
那我該怎麼做?
請各位指教~謝謝!
--
┌─────◆KKCITY◆─────┐▇─┐KKADSL→六星級優質連線服務
│ bbs.kkcity.com.tw │┴ └─▇ 馬上申請帶你上網環遊全世界!
└──《From:203.67.162.97 》──┘ KKADSL ┴ http://adsl.kkcity.com.tw
--
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
java 近期熱門文章
PTT數位生活區 即時熱門文章