Get the App
SLTechnology News&Howtos  ›  Development  › 

How to create objects using PrintStream in java

Shulou Source: shulou.com Published: 2022-06-03 05:17:23 10月02日 Update

This article mainly explains "how to use PrintStream in java to create objects". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to create objects using PrintStream in java.

1. Use the output stream out as the output stream of PrintStream. It will not automatically flush and use the default character set.

PrintStream out = new PrintStream (OutputStream out)

2. Create the FileOutputstream corresponding to File, and then use FileOutputstream as the output stream of Printstream.

PrintStream out = new PrintStream (File file)

Create a FileOutputStream for Filename, and then use FileoutputStream as the output stream of PrintStream.

PrintStream out = new PrintStream (String fileName, String charsetName)

The above is the object created by PrintStream in java. I hope it will be helpful to you. More Java Learning directions: Java Basics

Thank you for reading, the above is the content of "how to use PrintStream in java to create objects". After the study of this article, I believe you have a deeper understanding of how to use PrintStream in java to create objects, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Objects learning output content that is more basics characters character sets ideas situations articles knowledge knowledge points articles follow questions practice help directions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Xiaomi Shulou Information Shulou Technology Huawei