Java IO Tutorial - Java PrintStream.print(long l)








Syntax

PrintStream.print(long l) has the following syntax.

public void print(long l)

Example

In the following code shows how to use PrintStream.print(long l) method.

//from ww w .  ja v a 2  s . c o  m
import java.io.*;

public class Main {

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

         // print long
         ps.print(x);

         // flush the stream
         ps.flush();

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

The code above generates the following result.