Java PrintStream.println(long x)

Syntax

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

public void println(long x)

Example

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


import java.io.*;
//from   ww  w  . j  a  va  2 s  . c  o  m
public class Main {

   public static void main(String[] args) {
      long c = 1234567890L;
      try {
         
         PrintStream ps = new PrintStream(System.out);

         // print a long and change line
         ps.println(c);
         ps.print("from java2s.com");

         // flush the stream
         ps.flush();

      } catch (Exception ex) {
         ex.printStackTrace();
      }
   }
}

The code above generates the following result.