Skip to content

Commit 1eeb46f

Browse files
committed
Update Java Notes
1 parent 8d50848 commit 1eeb46f

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

Java.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2445,21 +2445,24 @@ s = s + "cd"; //s = abccd 新对象
24452445

24462446
#### 常用方法
24472447

2448-
`public boolean equals(String s)` : 比较两个字符串内容是否相同、区分大小写
2449-
`public boolean equalsIgnoreCase(String anotherString)` : 比较字符串的内容,忽略大小写
2450-
`public int length()` : 返回此字符串的长度
2451-
`public String trim()` : 返回一个字符串,其值为此字符串,并删除任何前导和尾随空格
2452-
`public String[] split(String regex)` : 将字符串按给定的正则表达式分割成字符串数组
2453-
`public char charAt(int index)` : 取索引处的值
2454-
`public char[] toCharArray()` : 将字符串拆分为字符数组后返回
2455-
`public boolean startsWith(String prefix)` : 测试此字符串是否以指定的前缀开头
2456-
`public int indexOf(String str)` : 返回指定子字符串第一次出现的字符串内的索引,没有返回-1
2457-
`public int lastIndexOf(String str)` : 返回字符串最后一次出现str的索引,没有返回-1
2458-
`public String substring(int beginIndex)` : 返回子字符串,以原字符串指定索引处到结尾
2459-
`public String substring(int i, int j)` : 指定索引处扩展到 j - 1 的位置,字符串长度为 j - i
2460-
`public String toLowerCase()` : 将此 String 所有字符转换为小写,使用默认语言环境的规则
2461-
`public String toUpperCase()` : 使用默认语言环境的规则将此 String 所有字符转换为大写
2462-
`public String replace(CharSequence target, CharSequence replacement)` : 使用新值,将字符串中的旧值替换,得到新的字符串
2448+
常用 API:
2449+
2450+
* `public boolean equals(String s)` : 比较两个字符串内容是否相同、区分大小写
2451+
2452+
* `public boolean equalsIgnoreCase(String anotherString)` : 比较字符串的内容,忽略大小写
2453+
* `public int length()` : 返回此字符串的长度
2454+
* `public String trim()` : 返回一个字符串,其值为此字符串,并删除任何前导和尾随空格
2455+
* `public String[] split(String regex)` : 将字符串按给定的正则表达式分割成字符串数组
2456+
* `public char charAt(int index)` : 取索引处的值
2457+
* `public char[] toCharArray()` : 将字符串拆分为字符数组后返回
2458+
* `public boolean startsWith(String prefix)` : 测试此字符串是否以指定的前缀开头
2459+
* `public int indexOf(String str)` : 返回指定子字符串第一次出现的字符串内的索引,没有返回 -1
2460+
* `public int lastIndexOf(String str)` : 返回字符串最后一次出现str的索引,没有返回 -1
2461+
* `public String substring(int beginIndex)` : 返回子字符串,以原字符串指定索引处到结尾
2462+
* `public String substring(int i, int j)` : 指定索引处扩展到 j - 1 的位置,字符串长度为 j - i
2463+
* `public String toLowerCase()` : 将此 String 所有字符转换为小写,使用默认语言环境的规则
2464+
* `public String toUpperCase()` : 使用默认语言环境的规则将此 String 所有字符转换为大写
2465+
* `public String replace(CharSequence target, CharSequence replacement)` : 使用新值,将字符串中的旧值替换,得到新的字符串
24632466

24642467
```java
24652468
String s = 123-78;
@@ -7070,12 +7073,9 @@ public class FileDemo {
70707073

70717074
#### 遍历目录
70727075

7073-
- `public String[] list()`:
7074-
获取当前目录下所有的"一级文件名称"到一个字符串数组中去返回。
7075-
- `public File[] listFiles()(常用)`:
7076-
获取当前目录下所有的"一级文件对象"到一个**文件对象数组**中去返回(**重点**)
7077-
- `public long lastModified` :
7078-
返回此抽象路径名表示的文件上次修改的时间。
7076+
- `public String[] list()`:获取当前目录下所有的"一级文件名称"到一个字符串数组中去返回。
7077+
- `public File[] listFiles()(常用)`:获取当前目录下所有的"一级文件对象"到一个**文件对象数组**中去返回(**重点**)
7078+
- `public long lastModified`:返回此抽象路径名表示的文件上次修改的时间。
70797079

70807080
```java
70817081
public class FileDemo {
@@ -7109,9 +7109,10 @@ public class FileDemo {
71097109

71107110
#### 文件搜索
71117111

7112-
递归实现文件搜索(非规律递归)
7113-
(1)定义一个方法用于做搜索。
7114-
(2)进入方法中进行业务搜索分析。
7112+
递归实现文件搜索(非规律递归)
7113+
7114+
* 定义一个方法用于做搜索
7115+
* 进入方法中进行业务搜索分析
71157116

71167117
```java
71177118
/**

0 commit comments

Comments
 (0)