Skip to content

十三章修改语句拗口问题 #630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Dec 7, 2020
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d88c904
1
Nov 19, 2020
6739439
Merge pull request #1 from LingCoder/master
andyphone Nov 24, 2020
ec2e1fa
2
Nov 24, 2020
c3373df
Merge branch 'master' of github.com:andyphone/OnJava8
Nov 24, 2020
7fbae68
没有第三种形式吧?
Nov 24, 2020
94afe9c
Merge pull request #2 from LingCoder/master
andyphone Nov 25, 2020
84e298c
修改语句拗口问题
Nov 25, 2020
429c653
修改语句拗口问题 2
Nov 25, 2020
34e5908
修改语句拗口问题 3
Nov 25, 2020
b027cf3
修改语句拗口问题 4
Nov 26, 2020
a183c0b
Merge pull request #3 from LingCoder/master
andyphone Nov 26, 2020
7ddf47f
修改语句拗口问题 5
Nov 26, 2020
57e0635
Merge branch 'master' of github.com:LingCoder/OnJava8
Nov 27, 2020
82aedb0
修改语句拗口问题 6
Nov 27, 2020
07231d7
修改语句拗口问题 7
Nov 27, 2020
b0d16e7
修改语句拗口问题 8
Nov 27, 2020
95a4cbb
修改语句拗口问题 9
Nov 27, 2020
826b9a2
拗口问题
andyphone Nov 29, 2020
ff9d336
修改语句拗口问题 10
Nov 30, 2020
a65ebda
Merge branch 'master' into master
andyphone Nov 30, 2020
446e2bd
修改语句拗口问题 11
Dec 1, 2020
e3e0f50
修改语句拗口问题 12
Dec 1, 2020
49dd428
修改语句拗口问题 13
Dec 1, 2020
25992cf
修改语句拗口问题 14
andyphone Dec 1, 2020
19d6135
Merge branch 'master' into master
andyphone Dec 1, 2020
1633ffd
修改语句拗口问题 14
Dec 2, 2020
8d1651b
修改语句拗口问题 15
Dec 3, 2020
1149eca
Merge pull request #4 from LingCoder/master
andyphone Dec 3, 2020
a4d14cc
修改语句拗口问题 16
Dec 3, 2020
1b97c98
修改语句拗口问题 17
Dec 4, 2020
952b2ff
十三章修改语句拗口问题
andyphone Dec 6, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
修改语句拗口问题 2
  • Loading branch information
jim.deng committed Nov 25, 2020
commit 429c653bc4418cded07773a32a56a18d3c5c6230
6 changes: 3 additions & 3 deletions docs/book/08-Reuse.md
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,9 @@ doh(Milhouse)

````

**Homer** 的所有重载方法在 **Bart** 中都是可用的,尽管 **Bart** 引入了一种新的重载方法。在下一章中你将看到,使用重写(与基类中完全相同的方法签名和返回类型覆盖相同名称的方法)比起重载会更为常见,否则就会令人困惑
**Homer** 的所有重载方法在 **Bart** 中都是可用的,尽管 **Bart** 引入了一种新的重载方法。正如你将在下一章中看到的那样,比起重载,更常见的是覆盖同名方法,使用与基类中完全相同的方法签名(方法名和参数类型)和返回类型。否则会让人感到困惑

你已经看到了Java 5 **@Override**注释,它不是关键字,但是可以像使用关键字一样使用它。当你打算重写一个方法时,你可以选择添加这个注释,如果你不小心用了重载而不是重写,编译器会产生一个错误消息:
你已经看到了Java 5 **@Override**注释,它不是关键字,但是可以像使用关键字一样使用它。当你打算重写一个方法(覆盖同名方法)时,你可以选择添加这个注释,如果你不小心用了重载而不是重写,编译器会产生一个错误消息:

```java
// reuse/Lisa.java
Expand All @@ -709,7 +709,7 @@ class Lisa extends Homer {

```

**{WillNotCompile}** 标记将该文件排除在本书的 **Gradle** 构建之外,但是如果你手工编译它,你将看到:方法不会覆盖超类中的方法, **@Override** 注释防止你意外地重载
**{WillNotCompile}** 标记将该文件排除在本书的 **Gradle** 构建之外,但是如果你手工编译它,你将看到:method does not override a method from its superclass.方法不会覆盖(重写)超类中的方法, **@Override** 注释能防止你意外地重载

<!-- Choosing Composition vs. Inheritance -->

Expand Down