1.system . out . println();
2.system . out . print();
3.System.out.printf()
system . out . println(); ? Is the most commonly used output statement, which converts the contents in parentheses into strings and outputs them to the output window (console), and wraps them. When the output is a basic data type, it will be automatically converted to a string. If the output is an object, the object's tostring () will be called automatically; Method (1) outputs the return value to the console.
system . out . print(); ? Similar to the first one, the difference is that the last output will wrap, while this command will not wrap after the output.
Brief introduction of input and output system
What is input-output processing (IO)
Including reading and writing console, memory, files, graphics and images, network and database. In the Java language, the java.io package provides?
Many complete input and output processing functions.
What is a stream?
A stream is an ordered byte source or destination. When a program needs to read data, it will open a stream to the data source. What about when the program needs it?
When writing data, it will open a stream to the destination, and the data will flow like a pipe. ?
Classification of streams?
There are three types of streams: input stream and output stream, byte stream and character stream, as well as node stream reading and writing from a specific location and filtered stream connecting existing streams. This classification is overlapping with each other.
Input stream and output stream
Byte stream and character stream
Node streams that read and write from specific locations and filtered streams that connect existing streams.
Introduction of basic process
The basic process generally refers to
Input stream
output stream
reader
author
1. input stream
This class is an abstract class. It is the parent class of all byte input classes, and its methods are called through subclass objects. What are the main methods?
2. Output stream
This class is an abstract class, the parent class of all byte output classes, and its methods are all called through subclass objects?
3. Character input and output sequence (character IO)
Input and output have two branches: character input with Reader as the parent class and character output with Writer as the parent class. They are isomorphic to its subclass * * *, forming a character input and output system.
Character input and output
4. Readers
Is an abstract class for reading character classes. It inputs the parent class of all characters' classes, and its methods are called through subclass objects. ?
5. Author
Is an abstract class used to write character streams. It is the parent class of all output character classes, and its methods are called through subclass objects.
Extension: introduction to Java:
Java is a computer programming language with the characteristics of cross-platform, object-oriented and generic programming, which is widely used in enterprise Web application development and mobile application development.
199 1 year, Sun Company and others began to develop a language named Oak. It is desirable to control a microprocessor embedded in a cable television exchange box, PDA, etc.
1994, Oak was renamed Java.
1998 JDK 1.2 changed its name to Java 2 platform?
Divided into standard J2SE, enterprise J2EE and mini J2ME.
Java is secure, portable and cross-platform, and people find that it can solve large-scale application problems on the Internet.
Internet makes Java the most popular programming language on the Internet.
The influence of Java on the Internet is also far-reaching.
The rise of B/S&; Decline of C/S
James, who works for Sun Microsystems? Gosling et al. developed the prototype of Java language in the early 1968+0990' s, originally named Oak, which is a programming language for small systems such as household appliances, and is applied to the control and communication of household appliances such as televisions, telephones, alarm clocks and toasters. Because the market demand of these smart home appliances is not as high as expected, Sun Company gave up this plan. With the development of Internet in11990s, Sun Company saw the application prospect of Oak on the Internet, so it reformed Oak and officially released it in the name of Java in May of 1995. With the rapid development of Internet, Java has gradually become an important network programming language.
The style of Java programming language is very close to that of C++. Java inherits the core of object-oriented technology in C++ language, and abandons pointers that are easy to cause errors in C++ language and replaces them with references. At the same time, the overload and operator of the original C++ are removed, and the multiple inheritance characteristics are removed, and the interface is replaced, which increases the function of the garbage collector. In Java SE 1.5, generic programming, type-safe enumeration, variable-length parameters and automatic unpacking are introduced. Sun Microsystems' explanation of Java language is: "Java programming language is a simple, object-oriented, distributed, explanatory, robust, secure and system-independent, portable, high-performance, multi-threaded and dynamic language."
Java is different from the general compilation language or literal translation language. It first compiles the source code into bytecode, and then relies on virtual machines on different platforms to interpret and execute bytecode, thus realizing the cross-platform characteristics of "write once and run everywhere". In the early JVM, this reduced the running efficiency of Java programs to some extent. However, after the release of J2SE 1.4.2, the running speed of Java has been greatly improved.
Different from the traditional mode, Sun took Java as an open technology when introducing it. Tens of thousands of Java development companies around the world are required to design Java software that must be compatible with each other. "Java language depends on the strength of the group, not the strength of the company" is one of Sun's slogans, and has been recognized by the majority of software developers. This is completely different from the elite-oriented and closed mode advocated by Microsoft. In addition, Microsoft later launched a competing. NET platform and a C# language imitating Java. Later, Sun Company was acquired by Oracle Bone Inscriptions Company, and Java became the product of Oracle Bone Inscriptions Company.