Java Essay II

Source: Internet
Author: User

1. Constant: The keyword final indicates that the variable can only be assigned once; you can use the keyword static final to set a class constant for use by multiple methods in a class.

2. String: Java does not have a built-in string type, but a predefined class is provided in the standard library, and each string enclosed in double quotation marks is an instance of the string class. Strings can be manipulated using the string class, such as "substring" and "concatenation", and the string class does not provide a method for modifying a string.

3. Build string: 1) A string connection method is used to construct a new string object for each connection, which is time consuming and wasteful, and can be avoided by using the StringBuilder class, which can be obtained by invoking the ToString method when a string is constructed.

4. Input and output: 1) When you want to enter through the console, you need to construct a scanner object and associate it with the standard input stream system.in. Scanner in = new Scanner (system.in); (The input of the password is available in the console class)

5.for Each loop: processes each element in the array in turn. for (variable:coolection) statement

Java Essay II

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.