Java Early Learning-String, StringBuilder, and Stringbuffer__java

Source: Internet
Author: User
Tags stringbuffer

Trust string This class is one of the most frequently used classes in Java, and it's a place for big companies to ask for interviews, and today you'll learn about the string, StringBuilder, and StringBuffer classes, Analyze their similarities and differences and understand the scenarios that each class applies to. The following is a table of contents outline for this article:

A. Do you know the string class?

Two. Deep understanding of String, StringBuffer, StringBuilder

Three. Performance testing of three classes in different scenarios

Four. Common questions about string and stringbuffer (some of the myths circulated on the web that distort string)

If there are any mistakes, please forgive and correct them, I appreciate it.

Please respect the results of the work of the author, reproduced please indicate the reprint address:

Http://www.cnblogs.com/dolphin0520/p/3778589.html one. Do you know the string class?

The best way to understand a class is to look at the implementation source code of the class, where the implementation of the String class

\jdk1.6.0_14\src\java\lang\string.java file.

Opening the class file will reveal that the string class was final decorated:

1 2 3 4 5 6 7 8 9 A (public ) final& nbsp class  String      implements  java.io.Serializable, Comparable<string> charsequence {    /** the value is used for character storage. */     PRIVATE&N Bsp final  char  value[];  

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.