String基础及常用方法

String类:

1.String称作不可变字符序列

2.位于java.lang包里

3.java字符串就是Unicode字符序列

•查看源码:

 

常量池分三种:

1.全局字符常量池  

2.class文件常量池

3.运行时常量池

测试实例String类的常用方法:

1.equals源码及应用:逐一比较内容

2.charAt方法:

用法:Returns the char value at the specified index. An index ranges from 0 to length() - 1. The first char value of the sequence is at index 0, the next at index 1, and so on, as for array indexing.

3.length方法、equlaIgnoreCase方法、indexOf方法、replace方法、

subString方法、trim方法

原文地址:https://www.cnblogs.com/laurarararararara/p/11448731.html