The construction method of the three parameters of the String class.

Source: Internet
Author: User

The construction method of the three parameters of the String class.

String (byte [] byte, int start, int length); If the byte array specifies a length of 12 but only stores 10 bytes, the length here can be up to 10, this understanding is super simple and never understood before. The API uses the default Character Set of the platform to decode the specified byte sub-array and construct a newString. NewStringIs a character set function, so it may not be equal to the length of the sub-array. If the given byte is invalid in the given character set, the behavior of this constructor is not specified. If you need more control over the decoding process, useCharsetDecoderClass.

The api cannot be understood. Ignore it first. Let's take a look at the application of this constructor, the output statement in the while loop. The result is that the html source code of the Baidu homepage is output on the console.


 

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.