import java.io.*;
public class io{ public static void main(String a[]){
byte []b;b=new byte[6];
int t=0;

try{ DataInputStream i=new DataInputStream( ByteArrayInputStream.in);   int str=i.read(b);
System.out.println(str);
for (int k=0;k<6;k++)
System.out.println("b["+k+"]="+b[k]);
}catch(Exception e){System.out.println(e.toString());
}
}}

解决方案 »

  1.   

    anyway,你也要把错误信息方上来吧.....
      

  2.   

    /*你要实现什么功能??
    是从键盘输入吗?
    还是要从文件里读?
    还是别的什么功能?
    如果是想从键盘输入的话:
    /*
    import java.io.*;
    public class io{ public static void main(String a[]){
    byte []b;b=new byte[6];
    int t=0;

    try{ DataInputStream i=new DataInputStream(System.in);   int str=i.read(b);
    System.out.println(str);
    for (int k=0;k<6;k++)
    System.out.println("b["+k+"]="+b[k]);
    }catch(Exception e){System.out.println(e.toString());
    }
    }}
      

  3.   

    ByteArrayInputStream类并没有in这个常量 
    先看看JAVA帮助文档 用System.in作为参数放进去DateInputStream构造函数中就行了
      

  4.   

    DataInputStream i=new DataInputStream( ByteArrayInputStream.in);   这个地方不对吧...
    DataInputStream i=new DataInputStream( System.in );
      

  5.   

    import java.io.*;
    public class io{public static void main(String a[]){
    byte []b;b=new byte[6];
    int t=0;try{ DataInputStream i=new DataInputStream(System.in);   int str=i.read(b);
    System.out.println(str);
    for (int k=0;k<6;k++)
    System.out.println("b["+k+"]="+(char)b[k]);
    }catch(Exception e){System.out.println(e.toString());
    }
    }}
    加一个强制转换就可以了