String and character
Method name
Method type
Method description
Public String (char[] value)
Construction method
Converts the specified array of characters into a string
Public
first, the String classString class in the Java.lang package, Java uses the string class to create a string variable that is part of the object. Java does not have a class for the final class that declares the string class. A string class object
String: string typeI,ConstructorString (Byte [] Bytes):Constructing string objects using Byte Arrays.String (Char [] Value):Construct a String object using a char array.String (Sting Original): ConstructOriginalOfCopy. That is:Copy an
Java String class learning (I) Overview and common methods, javastring
(Expansion: Api:The application interface provided by the programming language .)
I. Overview:
We usually post online. The title, content, and QQ chat content of the post are
Java entry (5) -- String/string class, entry String
In the previous example, there was a String example. Some friends certainly didn't know what to do. In fact, the String class is a special class in Java, namely the String class. It is not one of
1. Character arrays and strings.
A string can be converted into a character array. Similarly, a character array can be converted into a character string.
The following operations are provided in the string class.
1) convert the string into a
Three inheritance methods in class design and three inheritance methods are designed.Zookeeper
By inheritance, a new class can be derived from an existing class, and the derived class inherits the features of the base class, including methods. Just
Function Methods of the C ++ string class (for conversion)
Constructor of the string class:String (const char * s); // use the C string s for initializationString (int n, char C); // initialize with n characters CIn addition, the string class also
The advantage of the Objective-c language is that we are more flexible when writing code, such as we can forward the message to the object we want, or swap the implementation of a method at random. This feature means that objective-c requires not
Remove the character of the specified index--using the Charat () methodpublic class StringDemo { public static void main(String args[]) { String str = "hello"; // 定义字符串对象 char c = str.charAt(0); // 截取第一个字符
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.