Java IO Tutorial - Java CharArrayReader.ready()








Syntax

CharArrayReader.ready() has the following syntax.

public boolean ready()  throws IOException

Example

In the following code shows how to use CharArrayReader.ready() method.

import java.io.CharArrayReader;
/*from w  w  w  . jav  a2s.  c o  m*/
public class Main {
  public static void main(String[] args) throws Exception {

    char[] ch = { 'A', 'B', 'C', 'D', 'E' };


    CharArrayReader car = new CharArrayReader(ch);

    // test whether the stream is ready to be read
    boolean isReady = car.ready();

    // print
    System.out.println("Ready ? " + isReady);

  }
}

The code above generates the following result.