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;
/*  ww  w .ja  va2  s .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.