开发者社区> 问答> 正文

报错 The constructor String(Byte[], int, i?报错

请各位大神帮忙看看

class Recive implements Runnable {
    private PipedInputStream input=null;
    public Recive(){
        input=new PipedInputStream();
    }
    public PipedInputStream getInput(){
        return this.input;
    }
    public void run() {
        Byte[] b=new Byte[1000];
        int len=0;
        try {
            len=this.input.read();
        } catch (Exception e) {
            e.printStackTrace();
        }try {
            this.input.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
         System.out.println("接受的内容为 "+(new String(b,0,len)));//此处报错

            //The constructor String(Byte[], int, int) is undefined

    }
    
}




展开
收起
爱吃鱼的程序员 2020-06-14 14:40:43 572 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    还有将  Byte[]b=newByte[1000];这个改成   b yte[]b=newbyte[1000];

    楼主请采纳~~

    谢谢,写时没注意。。。。。看看你的jdk版本是多少?
    2020-06-14 14:41:00
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载

相关实验场景

更多