Java IO Tutorial - Java PrintWriter.println(long x)








Syntax

PrintWriter.println(long x) has the following syntax.

public void println(long x)

Example

In the following code shows how to use PrintWriter.println(long x) method.

//from   w  w w . java  2  s.  com
import java.io.*;

public class Main {

   public static void main(String[] args) {
      long l = 1234567890L;

      
      PrintWriter pw = new PrintWriter(System.out);

      // print long
      pw.println(l);
      pw.println(987654321L);

      // flush the writer
      pw.flush();

   }
}

The code above generates the following result.