Java language Basics

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.