Java.io.PrintWriter.print String() 方法 Java.io.PrintWriter.print Object() 方法 Java.io.PrintWriter.printf Locale() 方法 Java.io.PrintWriter.print String() 方法 package com.codingdict; import java.io.*; public class PrintWriterDemo { public static void main(String[] args) { String s = "Hello world."; try { // create a new writer PrintWriter pw = new PrintWriter(System.out); // print string pw.print(s); // change the line pw.println(); // print another string pw.print("This is an example."); // flush the writer pw.flush(); } catch (Exception ex) { ex.printStackTrace(); } } } Java.io.PrintWriter.print Object() 方法 Java.io.PrintWriter.printf Locale() 方法