Several Java common methods

xiaoxiao2021-03-06  105

1. charAt () ------ parameter int, returns to the character string given position String str = "asdfasdfasdfasdf"; str.charAt (8);. 2 substring () ---- parameters int, returns Given the INT value starts to the end of the string, if the parameter is two int, returns a string str.substring between the two int values; 4,12);

3. IndexOf () ----- Parameter char or string. Returns the location where the given characters are in the string. Note If the parameter is a char type, use 'c', if the parameter is a string, use "IBM", double quotes. Str.IndexOf ('c'); 4. final is used to define constants, its value cannot be changed; static is used to define class variables, and its value can be changed.

转载请注明原文地址:https://www.9cbs.com/read-104719.html

New Post(0)