Common Java Objects

Source: Internet
Author: User

Overview of the StringBuffer class
* A:stringbuffer class overview
* View the description of the StringBuffer class through the API provided by the JDK
* Thread-safe variable character sequences
* The difference between B:stringbuffer and string
* string is an immutable sequence of characters
* StringBuffer is a variable sequence of characters

The construction method of StringBuffer class
* Construction method of A:stringbuffer:
* Public StringBuffer (): Non-parametric construction method
* Public stringbuffer (int capacity): Specifies the capacity of the string buffer object
* Public StringBuffer (String str): String buffer object specifying string contents
* Method of B:stringbuffer:
* public int capacity (): Returns the current capacity. Theoretical value (not mastered)
* public int Length (): Returns the length (number of characters). Actual value

StringBuffer Add-on features
* Add function of A:stringbuffer
* Public stringbuffer append (String str):
* You can add any type of data to the string buffer and return the string buffer itself
* Public stringbuffer Insert (int offset,string str):
* Inserts any type of data into the string buffer at the specified location and returns the string buffer itself

StringBuffer removal function
* Delete Function of A:stringbuffer
* Public stringbuffer Deletecharat (int index):
* Deletes the character at the specified position and returns itself
* Public StringBuffer Delete (int start,int end):
* Deletes the end of the specified position starting at the specified position and returns itself

StringBuffer replacement and reversal functions
* Replacement function of A:stringbuffer
* Public stringbuffer replace (int start,int end,string str):
* Replace with STR from start to end
* B:stringbuffer reversal function
* Public StringBuffer reverse ():
* String reversal

interception function and precautions of StringBuffer
* Interception function of A:stringbuffer
* Public String substring (int start):
* Intercept from the specified position to the end
* Public String substring (int start,int end):
* Interception starts from the specified position to the end position, including the start position, not including the end position
* B: Precautions
* Note: The return value type is no longer stringbuffer itself

Conversion of StringBuffer and string to each other
* A:string--StringBuffer
* A: By construction method
* B: Through the Append () method
* B:stringbuffer--String
* A: By construction method
* B: Through the ToString () method
* C: Through substring (0,length);


The difference between StringBuffer and StringBuilder
* Overview of A:stringbuilder
* Learn about the StringBuilder class by looking at the API
* B: Face test
* The difference between string,stringbuffer,stringbuilder
* The difference between StringBuffer and StringBuilder
* StringBuffer is jdk1.0 version, is thread-safe, low efficiency
* StringBuilder is jdk1.5 version, is thread unsafe, high efficiency

* The difference between string and Stringbuffer,stringbuilder
* string is an immutable sequence of characters
* Stringbuffer,stringbuilder is a variable sequence of characters

String and StringBuffer are passed as arguments respectively
* A: Formal parameter issues
* string is passed as a parameter

* A:arrays class overview
* A tool class that operates on an array.
* Provides the functions of sorting, finding and so on.
* B: Member method
* public static String toString (int[] a)
* public static void sort (int[] a)
* public static int BinarySearch (int[] a,int key)

Overview of the basic type wrapper class
* A: why there is a basic type of packaging class
* The advantage of encapsulating a basic data type as an object is that more functional methods can be defined in the object to manipulate the data.
* B: Common operation
* One of the most common operations: used for conversions between basic data types and strings.
* C: Correspondence of basic types and packaging classes
BYTE byte
Shortshort
Intinteger
Longlong
Floatfloat
Doubledouble
Charcharacter
Booleanboolean

An overview of the integer class and how to construct it
* A:integer class overview
* See the description of the integer class through the API provided by the JDK

* The Integer class wraps the value of a primitive type int in the object,
* This class provides multiple methods to convert between int and String types.
* also provides some other constants and methods that are useful when working with int types
* B: Construction method
* Public Integer (int value)
* Public Integer (String s)


Mutual conversions of string and int types
* A:int--String
* A: and "" for stitching
* B:public static String valueOf (int i)
* C:int--integer--String (The ToString Method () of the Integer Class)
* D:public static String toString (int i) (static method for Integer class)
* b:string--INT
* a:string--Integer--INT
* public static int parseint (String s)

Common Java Objects

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.