List of usage examples for java.io PrintWriter append
public PrintWriter append(char c)
From source file:Main.java
public static void main(String[] args) { String s = "tutorial from java2s.com "; PrintWriter pw = new PrintWriter(System.out); // append the sequence pw.append(s); // check if there is an error and flush System.out.println("" + pw.checkError()); }
From source file:Main.java
public static void main(String[] args) { CharSequence sq1 = "Hello"; CharSequence sq2 = " World"; PrintWriter pw = new PrintWriter(System.out); // append the sequence pw.append(sq1); pw.append(sq2);/*w w w. ja va2 s .c o m*/ // flush the writer pw.flush(); }
From source file:Main.java
public static void main(String[] args) { try {//from w ww . j a v a2s .com PrintWriter pw = new PrintWriter(System.out); // append chars pw.append('H'); pw.append('e'); pw.append('l'); pw.append('l'); pw.append('o'); // flush the writer pw.flush(); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { try {/*from ww w .ja v a 2 s .c om*/ PrintWriter pw = new PrintWriter("c:/text.txt"); // append chars pw.append('H'); pw.append('e'); pw.append('l'); pw.append('l'); pw.append('o'); // flush the writer pw.flush(); pw.close(); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { try {/* w ww. j av a 2s. c o m*/ PrintWriter pw = new PrintWriter(System.out, true); // append chars pw.append('H'); pw.append('e'); pw.append('l'); pw.append('l'); pw.append('o'); // flush the writer pw.flush(); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { try {/*from w w w .jav a 2 s.c o m*/ PrintWriter pw = new PrintWriter("c:/text.txt", "ACSII"); // append chars pw.append('H'); pw.append('e'); pw.append('l'); pw.append('l'); pw.append('o'); // flush the writer pw.flush(); pw.close(); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { try {/*from ww w . ja v a 2 s. c o m*/ PrintWriter pw = new PrintWriter(new File("c:/text.txt")); // append chars pw.append('H'); pw.append('e'); pw.append('l'); pw.append('l'); pw.append('o'); // flush the writer pw.flush(); pw.close(); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { try {/* www .j ava 2s . c o m*/ PrintWriter pw = new PrintWriter(new FileWriter("c:/text.txt")); // append chars pw.append('H'); pw.append('e'); pw.append('l'); pw.append('l'); pw.append('o'); // flush the writer pw.flush(); pw.close(); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { String s = "tutorial from java2s.com "; try {//w w w . j ava 2s . c om PrintWriter pw = new PrintWriter(System.out); // append the sequence pw.append(s); // flush the writer pw.flush(); // print another string pw.println("This is an example"); // flush the writer again pw.flush(); // close the writer pw.close(); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { try {//from w w w .jav a2s . c o m PrintWriter pw = new PrintWriter(new File("c:/text.txt"), "ACSII"); // append chars pw.append('H'); pw.append('e'); pw.append('l'); pw.append('l'); pw.append('o'); // flush the writer pw.flush(); pw.close(); } catch (Exception ex) { ex.printStackTrace(); } }