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]);
//}
}
}
}
}
该怎么写?我写了好几种都是错的!请帮帮看下 先谢了

解决方案 »

  1.   

    楼主是想怎么转啊,你new String[20]肯定不行的嘛,String的构造函数没有String(int)的啊
      

  2.   

    怎么能在输入之前把x转换成String?或者就是以String输入也行~~~我想输入一个字符串~~但是总报错 我就改成输入数组了 可是后边又转换不过来~不知道改怎么改
      

  3.   

    new String(x) 就可以了
    或者你要用某种编码的话  new String(x,"GBK");
      

  4.   

    看来搂住是想读取输入的字符串吧
    试试这样:
    ——————————————————————
    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);
      }
    }——————————————————————不知是否对搂住有帮助。
      

  5.   

    x[20] = new String[20];
    语法错误. 应该是 x = new String[20];
    前提是 String [] x;