String
The base data type and the reference data type are used as method parameters, which are different when passing.
A: The basic data type is passed by value, which is equivalent to copying a copy of the past.
A reference data type is a pointer to a memory address, two places
The same data is used according to the address, and if changed, the original data is also changed.
Ternary operator "has?" And: Number "
Can be received by any type, judged
= = differs from equals
int age1 = 21;
int age2=22;
1, = = can be used for the comparison of integer or character type, can also be used for two-string memory address comparison
2. Equals for strings worth comparing
if (age1==age2) {
System.out.println ("This is true");
}else{
System.out.println ("This is false");
}
What method can I use to get the length of a string?
A: The string class provides the length () method to determine how long the string is.
The ubiquitous string
The strings in life
Frequently used strings: welcome into, hello World; education changes life;
storing strings using String objects
String s= "Hello World"
String s=new string ();
String s=new string ("Hello World");
The string class is located in the Java.lang package and has a rich method of calculating the length of the string, comparing the string,
The connection string that extracts the string.
Java Chapter 14th