System.out.println Past and Present

System.out.println () This function is very common print function, but you know it's the principle behind the operation when using this function do?

Here let us explore its trajectory.

First, create a test project using Eclipse

public class TestSystemOutPrintln {
    public static void main(String[] args) {
		System.out.println("hello world!");
	}
}

When we learn a new programming language, the first thing is to achieve a helloworld program. System.out.println () function, since we do not create an instance of this class you can call out an instance variable (println since this method can be called out, indicating that out is a class instance), indicating that the out variable is a static member variables, in a class only static member variables and methods, you can not create an instance of the class, use the class to directly call the member variables and methods directly, System this class, we can use the Eclipse IDE in System.class file Ctrl + Shift + t keyboard shortcut to open the type page, search System, open the file System.class

I am using java 12 release,

You can see out the variable type is static, final keyword modified, indicating that this variable is static, then the value is not changed, PrintStream class in the java.io package, println methods are written above 10 species overloaded method, parameter type can be integer, long integer, Boolean, single precision floating point, double precision floating point, character, character string, the object type, character array, there are no arguments, so we can use System.out.println () function to print values ​​of multiple variables on the console.

Published 19 original articles · won praise 0 · Views 1978

Guess you like

Origin blog.csdn.net/jiankangzhu/article/details/104328555