Java String Learning Notes

Source: Internet
Author: User

The following relationships are found in Java strings by looking at the JDK source code:

The methods in the interface are abstract by default and can be written or not written.

Public interface Charsequence {        int length ();       char charAt (int index);        Charsequence subsequence (int start, int end);     Public String toString ();}

The other is the implementation class of the interface and the final class, which cannot be inherited.

Public final class String    implements Java.io.Serializable, Comparable<string>, charsequence



<span style= "color: #ff0000;" >StringBuffe</span>
thread safety. However, there is a synchronous object lock, so performance degrades.
Public final class StringBuffer    extends Abstractstringbuilder    implements Java.io.Serializable, Charsequence


StringBuilder threads are not secure, but are highly efficient in a single-threaded environment.

Public final class StringBuilder    extends Abstractstringbuilder    implements Java.io.Serializable, Charsequence



Java String Learning Notes

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.