CSDN没人了吗?妈妈救救啊……
怎么实现 字符反转 不能调用库函数
比如:the china dalian microsoft
反转成为:microsoft dalian china the
不是 tfosorcim nailad anihc eht
我当时的错误示例:
错误1:class a
{
public static void main(String[] args)
{
String str= " the china dalian microsoft ";
char[] c=str.toCharArray();
char[] temp=new char[c.length];
for(int i=0,j=c.length-1;i <c.length;i++,j--)
{
temp[j]=c[i];
}
System.out.println(temp);
}
}
错误2:
class b
{
public static void main(String[] args)
{
String a = "da lian joyesoft ";
String c = " ";
StringBuffer b = new StringBuffe