1. Error message and debug information
Out is the output stream of standard debug information
ERR is the standard error message output stream
The declaration of this method is as follows:
public void println (String x)
The above parameter description x: The string that is output to the console
Public class Test { publicstaticvoid main (string[] args) { System.out.println ( "Main () method started running"); System.err.println ("Manually output an error message during run time:"); System.err.println ("\ t This software does not buy insurance, please pay attention to security"); System.out.println ("Printerroranddebug.main ()"); SYSTEM.OUT.PRINTLN ("main () method run End");} }
2. Use the Nextline () method to get the entire line of text string of the user input from the input stream, which is declared as follows:
Public String nextline ()
This method takes a line of text string from the input stream encapsulated by the scanner as the return value of the method
Import Java.util.Scanner; Public class test{ publicstaticvoid main (string[] args) { Scanner Scanner =new Scanner (system.in); System.out.println ("Please enter your ID number:"); Stringline =scanner.nextline (); System.out.println ("Original your ID number is:" +line.length () + "digit ah");} }
3.
Java language Basics