Package stdlib

Class StdOut

java.lang.Object
stdlib.StdOut

public final class StdOut extends Object
Standard output. This class provides methods for writing strings and numbers to standard output.

For additional documentation, see Section 1.5 of Introduction to Programming in Java: An Interdisciplinary Approach by Robert Sedgewick and Kevin Wayne.

  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Close standard output.
    static void
    Makes it so that this class does nothing; handy for performance testing (Added by James Riely 2014/02/23.)
    static void
    format(String format, Object... args)
    Print a formatted string to standard output using the specified format string and arguments, and flush standard output.
    static void
    format(Locale locale, String format, Object... args)
    Print a formatted string to standard output using the specified locale, format string, and arguments, and flush standard output.
    static void
    main(String[] args)
     
    static void
    Flush standard output.
    static void
    print(boolean x)
    Print a boolean to standard output and flush standard output.
    static void
    print(byte x)
    Print a byte to standard output and flush standard output.
    static void
    print(char x)
    Print a char to standard output and flush standard output.
    static void
    print(double x)
    Print a double to standard output and flush standard output.
    static void
    print(float x)
    Print a float to standard output and flush standard output.
    static void
    print(int x)
    Print an int to standard output and flush standard output.
    static void
    print(long x)
    Print a long to standard output and flush standard output.
    static void
    print(short x)
    Print a short to standard output and flush standard output.
    static void
    Print an Object to standard output and flush standard output.
    static void
    printf(String format, Object... args)
     
    static void
    printf(Locale locale, String format, Object... args)
     
    static void
    Terminate the current line by printing the line separator string.
    static void
    println(boolean x)
    Print a boolean to standard output and then terminate the line.
    static void
    println(byte x)
    Print a byte to standard output and then terminate the line.
    static void
    println(char x)
    Print a char to standard output and then terminate the line.
    static void
    println(double x)
    Print a double to standard output and then terminate the line.
    static void
    println(float x)
    Print a float to standard output and then terminate the line.
    static void
    println(int x)
    Print an int to standard output and then terminate the line.
    static void
    println(long x)
    Print a long to standard output and then terminate the line.
    static void
    println(short x)
    Print a short to standard output and then terminate the line.
    static void
    Print an object to standard output and then terminate the line.
    static void
    toFile(String filename)
    Redirect to a file.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • close

      public static void close()
      Close standard output.
    • println

      public static void println()
      Terminate the current line by printing the line separator string.
    • println

      public static void println(Object x)
      Print an object to standard output and then terminate the line.
    • println

      public static void println(boolean x)
      Print a boolean to standard output and then terminate the line.
    • println

      public static void println(char x)
      Print a char to standard output and then terminate the line.
    • println

      public static void println(double x)
      Print a double to standard output and then terminate the line.
    • println

      public static void println(float x)
      Print a float to standard output and then terminate the line.
    • println

      public static void println(int x)
      Print an int to standard output and then terminate the line.
    • println

      public static void println(long x)
      Print a long to standard output and then terminate the line.
    • println

      public static void println(short x)
      Print a short to standard output and then terminate the line.
    • println

      public static void println(byte x)
      Print a byte to standard output and then terminate the line.
    • print

      public static void print()
      Flush standard output.
    • print

      public static void print(Object x)
      Print an Object to standard output and flush standard output.
    • print

      public static void print(boolean x)
      Print a boolean to standard output and flush standard output.
    • print

      public static void print(char x)
      Print a char to standard output and flush standard output.
    • print

      public static void print(double x)
      Print a double to standard output and flush standard output.
    • print

      public static void print(float x)
      Print a float to standard output and flush standard output.
    • print

      public static void print(int x)
      Print an int to standard output and flush standard output.
    • print

      public static void print(long x)
      Print a long to standard output and flush standard output.
    • print

      public static void print(short x)
      Print a short to standard output and flush standard output.
    • print

      public static void print(byte x)
      Print a byte to standard output and flush standard output.
    • format

      public static void format(String format, Object... args)
      Print a formatted string to standard output using the specified format string and arguments, and flush standard output.
    • printf

      public static void printf(String format, Object... args)
    • format

      public static void format(Locale locale, String format, Object... args)
      Print a formatted string to standard output using the specified locale, format string, and arguments, and flush standard output.
    • printf

      public static void printf(Locale locale, String format, Object... args)
    • toFile

      public static void toFile(String filename)
      Redirect to a file. This is a hack to get programs to work easily in eclipse. (Added by James Riely 2012/01/12.)
    • doNothing

      public static void doNothing()
      Makes it so that this class does nothing; handy for performance testing (Added by James Riely 2014/02/23.)
    • main

      public static void main(String[] args)