Java.io.PushbackReader.read Char() 方法 Java.io.PushbackReader.read() 方法 Java.io.PushbackReader.ready() 方法 Java.io.PushbackReader.read Char() 方法 package com.codingdict; import java.io.*; public class PushbackReaderDemo { public static void main(String[] args) { String s = "Hello World"; // create a new StringReader StringReader sr = new StringReader(s); // create a new PushBack reader based on our string reader PushbackReader pr = new PushbackReader(sr, 20); // create a char array to read chars into char cbuf[] = new char[5]; try { // read characters into an array. System.out.println("" + pr.read(cbuf)); // print cbuf System.out.println(cbuf); // Close the stream pr.close(); } catch (IOException ex) { ex.printStackTrace(); } } } Java.io.PushbackReader.read() 方法 Java.io.PushbackReader.ready() 方法