## Uses of Class
java.io.PrintWriter

- Packages that use PrintWriter
  Package | Description
  --- | ---
  java.awt | Contains all of the classes for creating user interfaces and for painting graphics and images.
  java.io | Provides for system input and output through data streams, serialization and the file system.
  java.lang | Provides classes that are fundamental to the design of the Java programming language.
  java.sql | Provides the API for accessing and processing data stored in a data source (usually a relational database) using the JavaTM programming language.
  java.util | Contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes (a string tokenizer, a random-number generator, and a bit array).
  javax.sql | Provides the API for server side data source access and processing from the JavaTM programming language.
  javax.xml.bind | Provides a runtime binding framework for client applications including unmarshalling, marshalling, and validation capabilities.
  javax.xml.crypto | Common classes for XML cryptography.
  javax.xml.crypto.dsig | Classes for generating and validating XML digital signatures.
  javax.xml.transform | This package defines the generic APIs for processing transformation instructions, and performing a transformation from source to result.
  javax.xml.xpath | This package provides an object-model neutral API for the evaluation of XPath expressions and access to the evaluation environment.

- - ### Uses of PrintWriter in java.awt

    Methods in java.awt with parameters of type PrintWriter
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | Component.`list(PrintWriter out)` Prints a listing to the specified print writer.
    `void` | Component.`list(PrintWriter out, int indent)` Prints out a list, starting at the specified indentation, to the specified print writer.
    `void` | Container.`list(PrintWriter out, int indent)` Prints out a list, starting at the specified indentation, to the specified print writer.

  - ### Uses of PrintWriter in java.io

    Methods in java.io that return PrintWriter
    Modifier and Type | Method | Description
    --- | --- | ---
    `PrintWriter` | PrintWriter.`append(char c)` Appends the specified character to this writer.
    `PrintWriter` | PrintWriter.`append(CharSequence csq)` Appends the specified character sequence to this writer.
    `PrintWriter` | PrintWriter.`append(CharSequence csq, int start, int end)` Appends a subsequence of the specified character sequence to this writer.
    `PrintWriter` | PrintWriter.`format(Locale l, String format, Object... args)` Writes a formatted string to this writer using the specified format string and arguments.
    `PrintWriter` | PrintWriter.`format(String format, Object... args)` Writes a formatted string to this writer using the specified format string and arguments.
    `PrintWriter` | PrintWriter.`printf(Locale l, String format, Object... args)` A convenience method to write a formatted string to this writer using the specified format string and arguments.
    `PrintWriter` | PrintWriter.`printf(String format, Object... args)` A convenience method to write a formatted string to this writer using the specified format string and arguments.
    `PrintWriter` | Console.`writer()` Retrieves the unique `PrintWriter` object associated with this console.

  - ### Uses of PrintWriter in java.lang

    Methods in java.lang with parameters of type PrintWriter
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | Throwable.`printStackTrace(PrintWriter s)` Prints this throwable and its backtrace to the specified print writer.

  - ### Uses of PrintWriter in java.sql

    Methods in java.sql that return PrintWriter
    Modifier and Type | Method | Description
    --- | --- | ---
    `static PrintWriter` | DriverManager.`getLogWriter()` Retrieves the log writer.

    Methods in java.sql with parameters of type PrintWriter
    Modifier and Type | Method | Description
    --- | --- | ---
    `static void` | DriverManager.`setLogWriter(PrintWriter out)` Sets the logging/tracing `PrintWriter` object that is used by the `DriverManager` and all drivers.

  - ### Uses of PrintWriter in java.util

    Methods in java.util with parameters of type PrintWriter
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | Properties.`list(PrintWriter out)` Prints this property list out to the specified output stream.

  - ### Uses of PrintWriter in javax.sql

    Methods in javax.sql that return PrintWriter
    Modifier and Type | Method | Description
    --- | --- | ---
    `PrintWriter` | CommonDataSource.`getLogWriter()` Retrieves the log writer for this `DataSource` object.

    Methods in javax.sql with parameters of type PrintWriter
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | CommonDataSource.`setLogWriter(PrintWriter out)` Sets the log writer for this `DataSource` object to the given `java.io.PrintWriter` object.

  - ### Uses of PrintWriter in javax.xml.bind

    Methods in javax.xml.bind with parameters of type PrintWriter
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | JAXBException.`printStackTrace(PrintWriter s)` Prints this JAXBException and its stack trace (including the stack trace of the linkedException if it is non-null) to the PrintWriter.

  - ### Uses of PrintWriter in javax.xml.crypto

    Methods in javax.xml.crypto with parameters of type PrintWriter
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | NoSuchMechanismException.`printStackTrace(PrintWriter s)` Prints this `NoSuchMechanismException`, its backtrace and the cause's backtrace to the specified print writer.
    `void` | URIReferenceException.`printStackTrace(PrintWriter s)` Prints this `URIReferenceException`, its backtrace and the cause's backtrace to the specified print writer.
    `void` | KeySelectorException.`printStackTrace(PrintWriter s)` Prints this `KeySelectorException`, its backtrace and the cause's backtrace to the specified print writer.
    `void` | MarshalException.`printStackTrace(PrintWriter s)` Prints this `MarshalException`, its backtrace and the cause's backtrace to the specified print writer.

  - ### Uses of PrintWriter in javax.xml.crypto.dsig

    Methods in javax.xml.crypto.dsig with parameters of type PrintWriter
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | XMLSignatureException.`printStackTrace(PrintWriter s)` Prints this `XMLSignatureException`, its backtrace and the cause's backtrace to the specified print writer.
    `void` | TransformException.`printStackTrace(PrintWriter s)` Prints this `TransformException`, its backtrace and the cause's backtrace to the specified print writer.

  - ### Uses of PrintWriter in javax.xml.transform

    Methods in javax.xml.transform with parameters of type PrintWriter
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | TransformerException.`printStackTrace(PrintWriter s)` Print the the trace of methods from where the error originated.

  - ### Uses of PrintWriter in javax.xml.xpath

    Methods in javax.xml.xpath with parameters of type PrintWriter
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | XPathException.`printStackTrace(PrintWriter s)` Print stack trace to specified `PrintWriter`.

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.