Java Chapter 14th

Source: Internet
Author: User
       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

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.