Using Java to understand program logic (15)

Source: Internet
Author: User

Package Three;//declaration Pack
Import Java.util.scanner;//importing the System Package
Import one.two.school;//importing a user package
Import one.two.animal;//recommended: do not waste memory
Import one.two.*;//* for all classes under One.two package (not recommended: wasted)

Normal String: The string has an automatic optimization capability definition when there is a direct reference to the memory found

Object string can only be used with equals = =

Equalsignorecase () Ignoring case comparisons

Concat can only be spliced with strings

+ string and any type can be spliced

IndexOf
IndexOf from left to right 1th returns the index of the original string
LastIndexOf from right to left 1th returns the index of the original string

int A=email.indexof ("2", 6);//sub-string in the original string where the index-1: there is no >=0 exists

Substring: Intercepting strings

String email= "[email protected]";
String b=email.substring (9,11);//intercept from 9 index to 11 index before one (end index does not intercept)

Split splits a String--array

Using Java to understand program logic (15)

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.