Skip to content

Commit

Permalink
update: 240305 ver03
Browse files Browse the repository at this point in the history
  • Loading branch information
V1CeVersaa committed Mar 5, 2024
1 parent 7bfd5e4 commit ef9df60
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 19 deletions.
1 change: 1 addition & 0 deletions docs/Computer Science/Algorithm/01 Algorithm Analysis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## Chapter 1 Algorithm Analysis
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Algorithms and Data Structure

Empty file.
2 changes: 1 addition & 1 deletion docs/Computer Science/Algorithm/Discrete Mathematics.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Discrete Mathematics

!!! Abstract
这是我在2023-2024学年春夏学期修读《离散数学理论基础》的课程笔记,由于我实在不想将它安排在数学一类,加之以`markdown`编写,所以就放在了这里。
这是我在2023-2024学年春夏学期修读《离散数学理论基础》的课程笔记,由于我实在不想将它安排在数学一类,加之其以`markdown`编写,所以就放在了这里。

参考书籍:

Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion docs/Computer Science/Algorithm/ads.md

This file was deleted.

39 changes: 28 additions & 11 deletions docs/Computer Science/Programming Language/Java.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class FirstSample{

关键词`public`被称为**访问修饰符/Access modifier**,决定了控制程序其他部分对这部分代码的访问级别。`class`表示Java程序中的**全部内容**都包含在类中,类是Java应用的构建模块。一个源文件只能有一个公共类,但是可以有任意数量的非公共类,源文件的文件名必须和公共类的类名相同,并且用`.java`作为扩展名。

在执行已经编译的程序的时候,虚拟机总是从指定类的`main`方法的代码开始执行,所以类的源代码中必须包含一个`main`方法,且`main`方法必须声明为`public`。方法其实就是函数的另外一种说法,我们也可以自行定义方法并且添加到类中。
在执行已经编译的程序的时候,虚拟机总是从指定类的`main`方法的代码开始执行,所以类的源代码中必须包含一个`main`方法,且`main`方法必须声明为`public`,当然直接声明全套`public static`也是极好的。方法其实就是函数的另外一种说法,我们也可以自行定义方法并且添加到类中。

### 1.3 对象与类

Expand Down Expand Up @@ -149,33 +149,50 @@ public class Employee{

如果一个方法是私有的,并且类的作者确信这个方法不会在别处使用,这个方法就可以被简单地剔除,但是如果方法是公共的,就不能简单地删除一个方法了,因为还有可能会有其余的代码依赖于这个方法。

我们可以将一些实例字段设置为`final`,这样的字段必须在构造对象的时候就被初始化,而且存储在该对象的对象引用不会再指向另一个不同的对象。比如`private final StringBuilder evaluations = new StringBuilder();`,这里的`evaluations`就不能指向别的对象了,但是这个对象可以修改,比如`evaluations.append(LocalDate.now() + ":Yes!")``final`修饰符对于类型为基本类型或者**不可变类**的字段尤其有用
我们可以将一些变量、类与方法设置为`final`。当我们定义一个类时使用了`final`修饰,这个类就不能被继承,这个类的成员变量可以根据需要设为`final`,但是类中的所有成员方法都会被设为`final`。如果定义了一个方法为`final`,这个方法就被“锁定”了,无法被子类的 方法重写,对方法定义为`final`一般常见于认为这个方法已经足够完整,不需要改变了。修饰变量是`final`用的最多的地方,`final`变量**必须显式指定初始值**,并且一旦被赋值,就不能给被重新赋值;如果`final`的是一个基本变量,这个变量就不能改动了,如果是一个**引用变量**,那么**对其初始化之后就不能再指向其他变量**

### 1.3.4 静态字段与静态方法
比如`private final StringBuilder evaluations = new StringBuilder();`,这里的`evaluations`就不能指向别的对象了,但是这个对象可以修改,比如`evaluations.append(LocalDate.now() + ":Yes!")``final`修饰符对于类型为基本类型或者**不可变类**的字段尤其有用,并且`final`修饰符一般与`static`修饰符一起使用。

#### 1.3.4 静态字段与静态方法

我们发现,先前的很多方法都标记了`static`修饰符,下面


### 1.4. 数据类型
### 1.4 数据类型

**数据类型**就是一组数据与对其能进行的操作的集合。

#### 1.4.1 基本类型
Java是典型的C类语言,声明变量的方法与C极为相似,但是在Java中,变量名的标识符的组成得到了扩充:字母、数字、货币符号与“标点链接符”组成变量名,首字母不能为数字。特别地,字母、数字与货币符号的范围更大,字母可以是一种语言表示中的**任何Unicode**字符,数字可以是`0``9`**表示一位数字的任何Unicode**字符。

Java最基本的类型有四种:
#### 1.4.1 基本类型

- **整型**,与其对应的算数运算符(`int`)。
Java最基本的类型有下面几种,六种数字类型,一种字符类型,一种布尔型:

我们使用`int`类型来表示整数,使用32位二进制补码来记录数据。`int`类型的取值范围是`-2^31``2^31-1`,也就是`-2147483648``2147483647`。相关运算符有`+``-``*``/``%``++``--`
- **整型**

- **双精度实数类型**,与其对应的算数运算符(`double`)。

我们使用`double`类型来表示双精度实数,使用64位,值域非常之大。

#### 1.4.2 表达式
- **字符型`char`**`char`使用UTF-16方案进行编码,以前原本用于表示单个字符,但是现在情况变化了,有的Unicode字符需要两个`char`值。`char`类型的字面量要用单引号括起来,也可以表示为十六进制的值,比如`\u0041`就是`A`

在Unicode编码之前,已经有许多编码标准了,我们最熟悉的就是美国的ASCII编码。标准不统一会出现下面两个问题:对一个特定的代码值,在不同的机制中对应不同的字母;大字符集的语言的编码长度会有不同,有的是单字节编码,有的就使用双字节或者多字节编码。

Java的字符型使用的16位编码在当时设计时的确是很好的改进,但是现在的Unicode字符已经超过65536个,这就尴尬住了。所以一个实用的建议就是不要在程序之中使用`char`类型,除非要处理UTF-16代码单元,否则就使用`String`类型。

还是简单介绍一下Unicode编码吧:**码点/Code point**是指与一个编码表中某个字符对应的代码值,Unicode中的码点使用十六进制书写,并且在前面加上一个`U+``U+0041`就是A的码点。Unicode中的码点可以分为**17个代码平面/Code plane**。第一个代码平面被称为**基本多语言平面/Basic multilingual plane**,其包含了从`U+0000``U+FFFF`的“经典”Unicode编码,其余的16个代码平面从`U+10000``U+10FFFF`,包含了各种**辅助字符/Supplementary character**,这些平面包含了一些不常用的字符,比如一些古代文字、表意文字等等。

UTF-16使用不同长度的代码表示所有Unicode码点,在基本多语言平面之中,每个字符使用16位表示,被称为**代码单元/Code unit**,辅助字符使用一对连续的代码单元表示,这种编码对使用基本多语言平面中未采用的2048个值范围(称为替代区域,`U+D800``U+DBFF`用于第一个代码单元,`U+DC00``U+DFFF`用于第二个代码单元)。而Java中的`char`类型描述就采用了UTF-16编码的一个代码单元。




#### 1.4.2 运算符

### 1.5 控制语句


### 1.1.6 字符串
### 1.6 字符串

### 1.1.7 输入输出
### 1.7 输入输出

2 changes: 1 addition & 1 deletion docs/Math/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<div class="file-title">A Little More Analysis</div>
<div class="file-meta">383 KB / 63 P / 2024-02-16</div>
</div>
<a class="down-button" target="_blank" href="Analysis/A Little More Analysis.pdf" markdown="1">:fontawesome-solid-download: 下载</a>
<a class="down-button" target="_blank" href="/Math/Analysis/A Little More Analysis.pdf" markdown="1">:fontawesome-solid-download: 下载</a>
</div>

### Analysis All in One
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Hi!欢迎来到我的笔记本,我会在这里更新我的**课程笔记**.

- [ ] 计算机系统:[CSAPP](./Computer%20Science/System/CSAPP.md)
- [ ] 某种古老又强大的命令语言:[Shell](./Computer%20Science/Programming%20Basis/Shell.md)
- [ ] CPU给我干烧了:[Foundamental Data Structure](./Computer%20Science/Algorithm/Foundamental%20Data%20Structure.md)
- [ ] CPU给我干烧了:[Algorithms and Data Structure](./Computer%20Science/Algorithm/Algorithms%20and%20Data%20Structure.md)

<!-- # Who Am I?
Expand Down
6 changes: 3 additions & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ nav:
- Algorithm:
- Computer Science/Algorithm/index.md
- Discrete Mathematics: Computer Science/Algorithm/Discrete Mathematics.md
- Fundamental Data Structure: Computer Science/Algorithm/Foundamental Data Structure.md
- Advanced Data Structure and Alogrithm Analysis: Computer Science/Algorithm/ads.md
- Algorithms: Computer Science/Algorithm/Algorithms.md
- Algorithms and Data Structure:
- Computer Science/Algorithm/Algorithms and Data Structure.md
- Algorithm Analysis: Computer Science/Algorithm/01 Algorithm Analysis.md
- System:
- Computer Science/System/index.md
- Verilog: Computer Science/System/Verilog.md
Expand Down

0 comments on commit ef9df60

Please sign in to comment.