开发者

Ctrl-z and BufferedReader

开发者 https://www.devze.com 2023-04-02 14:42 出处:网络
I dont know what I\'m doing wrong. When I hit control-z, I expected the \"done\" statement to be printed on the screen. But it does not print it.Please let me know why.

I dont know what I'm doing wrong. When I hit control-z, I expected the "done" statement to be printed on the screen. But it does not print it.Please let me know why.

import java.io.*;
import java.lang.*;
import java.util.*; 


class Cdt
{       
  public static void main(String args[])
{
   String s=new String(); 
  try{
     BufferedReader br=new BufferedReader(new InputS开发者_如何学GotreamReader(System.in));

     while (s!=null)
    {  
        s=br.readLine();
      System.out.println(s);
    }
     System.out.println("Done"); 
   }catch(IOException e){}
}   


}
0

精彩评论

暂无评论...
验证码 换一张
取 消