List of usage examples for java.io PrintWriter println
public void println(Object x)
From source file:MainClass.java
public static void main(String[] args) { PrintWriter out = new PrintWriter(System.out, true); out.println("Hello, world"); }
From source file:Main.java
public static void main(String[] argv) throws Exception { FileWriter file = new FileWriter("a.html"); BufferedWriter buffer = new BufferedWriter(file); PrintWriter out = new PrintWriter(buffer); out.println("<html>\n\t<body>"); out.println("\t</body>\n</html>"); out.close();//from ww w.ja v a 2 s .c om buffer.close(); file.close(); }
From source file:PrintWriterDemo.java
public static void main(String args[]) { PrintWriter pw = new PrintWriter(System.out, true); pw.println("This is a string"); int i = -7;/* w w w .jav a 2 s.com*/ pw.println(i); double d = 4.5e-7; pw.println(d); }
From source file:MainClass.java
public static void main(String args[]) throws Exception { FileWriter fw = new FileWriter(args[0]); BufferedWriter bw = new BufferedWriter(fw); PrintWriter pw = new PrintWriter(bw, false); pw.println(true); pw.println('A'); pw.println(500);//from w w w . j a va 2 s .c o m pw.println(40000L); pw.println(45.67f); pw.println(45.67); pw.println("Hello"); pw.println(new Integer("99")); pw.close(); }
From source file:SSLSimpleClient.java
public static void main(String[] args) throws Exception { SocketFactory sf = SSLSocketFactory.getDefault(); Socket s = sf.createSocket(args[0], Integer.parseInt(args[1])); BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream())); PrintWriter pw = new PrintWriter(s.getOutputStream()); pw.println("from java2s."); pw.flush();//w w w. java2 s. co m System.out.println(br.readLine()); s.close(); }
From source file:MainClass.java
public static void main(String[] a) throws Exception { URL url = new URL("http://www.yourdomain.com/form.jsp"); URLConnection connection = url.openConnection(); connection.setDoOutput(true);// w w w . ja v a 2 s . co m PrintWriter out = new PrintWriter(connection.getOutputStream()); out.println("firstName=Joe"); out.println("lastName=Average"); out.close(); }
From source file:MainClass.java
public static void main(String[] args) { try {//from www. j a va 2 s . c om PrintWriter pw = new PrintWriter("c:\\temp\\printWriterOutput.txt"); pw.println("PrintWriter is easy to use."); pw.println(1234); pw.close(); } catch (IOException e) { } }
From source file:Main.java
public static void main(String[] args) throws Exception { // creates a console object Console cnsl = System.console(); // if console is not null if (cnsl != null) { // creates new print writer PrintWriter out = cnsl.writer(); // prints out.println("Here is The Optimus Prime!!"); }//w w w . j a v a 2s . com }
From source file:Main.java
public static void main(String[] args) { int i = 123;/*from w w w. ja v a2s .c o m*/ PrintWriter pw = new PrintWriter(System.out); // print int pw.println(i); pw.println(987); // flush the writer pw.flush(); }
From source file:SecureServer.java
public static void main(String[] args) throws Exception { ServerSocketFactory ssf = SSLServerSocketFactory.getDefault(); SSLServerSocket ss = (SSLServerSocket) ssf.createServerSocket(98999); Socket sock = ss.accept();//from w w w . j a v a2 s . c o m ss.close(); OutputStream rawOut = sock.getOutputStream(); PrintWriter out = new PrintWriter(new OutputStreamWriter(rawOut)); out.println(new java.util.Date().toString()); out.flush(); sock.close(); }