Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
ilovecopy committed Jan 28, 2024
1 parent 352c843 commit fbb0fe4
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ start.sh
setting.sh
docs/.vuepress/styles/palette.scss
docs/.vuepress/dist
commitlint.config.js
2 changes: 2 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ features:
details: 物理层、数据链路层、网络层、传输层、应用层。
- title: MySQL
details: 索引、事务、锁。
- title: Java
details:
footer: MIT Licensed | Copyright © 2023-present ilovecopy

---
Expand Down
13 changes: 13 additions & 0 deletions docs/java/008.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# String

```
private final char value[];
```

在循环里字符串拼接不要用+,要用StringBuilder。

![image-20240128093814484](https://csnotes.oss-cn-beijing.aliyuncs.com/photos/image-20240128093814484.png)

String不能用String[0]取数。

要用String.charAt[0]取数。
5 changes: 5 additions & 0 deletions docs/java/009.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# StringBuffer

char[] value;

可以改值。减少内存消耗
4 changes: 4 additions & 0 deletions docs/java/012.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# final关键字

final定义的字段必须在构造对象时初始化,也就是常量。

3 changes: 3 additions & 0 deletions docs/java/013.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# static关键字

static关键字用于把所有的对象用同一块内存存起来。
45 changes: 45 additions & 0 deletions docs/java/014.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# String类

String类是个final类,不能被其他类继承。

```java
public static void main(String[] args) {
String name = "NU";
name = "tom";
final char[] value = {'a', 'b', 'c'};
char[] v2={'a','b','c'};
value[0] = 'd';
value=v2;//报错,因为value是final的,不能改地址。
}
```

```
String s = "hdp";
String s = new String("qwe");
```

```
public static void main(String[] args) {
//a指向常量池中的"abc"
String a = "abc";
String b = "abc";
//a和b的值相等
System.out.println(a.equals(b));//true
//a和b指向同一个对象
System.out.println(a == b);//true
}
```

```
public static void main(String[] args) {
//a指向常量池中的"abc"
String a = "abc";
String b = "de";
String c = a + b
//StringBuilder sb = new StringBuilder();
//sb.append("abc");
/sb.append("de");
//String c = sb.toString();
}
```

2 changes: 1 addition & 1 deletion docs/leetcode/000.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# 刷题工具

LeetCode+Idea
LeetCode+VSCode
4 changes: 2 additions & 2 deletions docs/yearplan/000.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

每天都要有一个 commit,学一集 Java,写一道 LeetCode。

新的一年希望把 CSDIY 和鱼皮的 Java 路线给肝完吧。。。
新的一年希望把鱼皮的 Java 路线给肝完吧。。。

### 理财计划

Expand All @@ -30,4 +30,4 @@

### 长期计划

坚持写博客。希望自己的知乎粉丝能破万,博客的 GitHub Star 数量能破万(目前为 0)。
坚持写博客。希望自己的知乎粉丝能破万,博客的 GitHub Star 数量能破万(目前为 0)。小宇宙更一集故事。希望出一个能上镜的视频系列。

0 comments on commit fbb0fe4

Please sign in to comment.