Java IO Tutorial - Java CharArrayReader.ready()


CharArrayReader.ready() has the following syntax.

public boolean ready()  throws IOException


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

/*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.