PrintWriter ¿¹Á¦
PrintWriterTest.java
import java.io.*;
public class PrintWriterTest {
private String name = null;
private String s = null;
private int year = 0;
public PrintWriterTest(String name, String s, int year) {
this.name = name;
this.s = s;
this.year = year;
}
public static void main(String[] args) throws IOException {
PrintWriterTest pwt = new PrintWriterTest("http://www.jabook.org ", "since", 2000);
FileWriter fwrite = new FileWriter("PrintWriterTest.txt");
PrintWriter pw = new PrintWriter(fwrite);
pw.println(pwt.name);
pw.print(pwt.s);
pw.print(pwt.year);
pw.close();
}
}
C:\JavaExample\09>javac PrintWriterTest.java
C:\JavaExample\09>java PrintWriterTest
ÅØ½ºÆ® ŸÀÔÀÇ ±âº» µ¥ÀÌÅÍ Å¸ÀÔ ¹× °´Ã¼ÀÇ °ªÀ» Ãâ·ÂÇϴ Ŭ·¡½º
jabookÀúÀÚ¸íÇÔ |
Á¦¸ñ:¼Ò¼³°°Àº¹Ì´ÏÄÚµå ÀÛ¼ºÀÚ:Àںϸâ¹ö ÃÖ¿ë¼ú |