public String readLine() throws IOException {
        return readLine(false);
    }这是类里的,不明白return readLine(false);这句是什么用法哦,谁能帮解释一下?干嘛里面放个false是什么意思?

解决方案 »

  1.   

    估计是附近还有个public String readLine(boolean arg){...}方法
      

  2.   

    Eclipse里 按住Ctrl 单击readLine(false)
      

  3.   

    是指BufferedReader吧?
    其实是调用了另一个函数:
    String readLine(boolean ignoreLF) throws IOException 至于参数false是啥意思,JDK解释的很清楚:
    Reads a line of text.  A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.@param      ignoreLF  If true, the next '\n' will be skipped也就是,如果为true,下一个回车(\n)会被忽略掉。
      

  4.   

    只知道BufferReader有个ReadLine是读取一行的意思
      

  5.   


    看不懂这英语啊,哎,“如果为true,下一个回车(\n)会被忽略掉。”这句话是什么意思哦,意思是遇到回车就停止读取?
      

  6.   

    API是这样写的public String readLine()
                    throws IOException
    Reads a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.Returns:
    A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached这个boolean参数的意思就是,是否忽略换行符,默认为false,也就是不忽略,意思就是读取一行,并且换行
      

  7.   

    public String readLine()
                    throws IOException读取一个文本行。通过下列字符之一即可认为某行已终止:换行 ('\n')、回车 ('\r') 或回车后直接跟着换行。 返回:
    包含该行内容的字符串,不包含任何行终止符,如果已到达流末尾,则返回 null 
    抛出: 
    IOException - 如果发生 I/O 错误
      

  8.   

    只知道BufferReader有个ReadLine是读取一行的意思
    -------------------------------------------------------
    ++