请教大神为啥这个程序运行时啥也没显示?

import java.io.ByteArrayInputStream;

public class TestByteArrayInputStream1 {

public static void main(String[] args) {
    String s="abcdefghijklmnopqrstuvwxyz";
    byte[] temp=s.getBytes();
    ByteArrayInputStream bais=new ByteArrayInputStream(temp);

    int d;
    d=bais.read();
    while(d!=-1){
        System.out.print((char)d);
        bais.read();
    }

}

}

数据流没刷新?字符串后面加个'\n'试试?

有显示啊,你是不是看错显示窗口了?图片说明

输入输出流要关流, 要不然就在缓存中存储着,