import java.io.*;public class fo
{
public static void main(String [] args) throws Exception
{
byte x[] = new byte[20];
System.in.read(x);
//x[20] = new String[20];
for(int i=0;i<x.length;i++)
{
for(int j=0;j<x.length;j++)
{
x[20] = new String[20];
//if (x[i]!=null&&x[j]!=null)
//{
System.out.print(x[i]+x[j]);
//}
}
}
}
}
该怎么写?我写了好几种都是错的!请帮帮看下 先谢了
{
public static void main(String [] args) throws Exception
{
byte x[] = new byte[20];
System.in.read(x);
//x[20] = new String[20];
for(int i=0;i<x.length;i++)
{
for(int j=0;j<x.length;j++)
{
x[20] = new String[20];
//if (x[i]!=null&&x[j]!=null)
//{
System.out.print(x[i]+x[j]);
//}
}
}
}
}
该怎么写?我写了好几种都是错的!请帮帮看下 先谢了
或者你要用某种编码的话 new String(x,"GBK");
试试这样:
——————————————————————
package com.chao.test;import java.io.*;public class Fo {
public static void main(String[] args) throws IOException {
BufferedReader buf;
String str;
buf = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Please input a string:");
str = buf.readLine(); //读取字符串,敲回车结束
System.out.println("The string You input is: " + str);
}
}——————————————————————不知是否对搂住有帮助。
语法错误. 应该是 x = new String[20];
前提是 String [] x;