Skip to content

Commit 4fe24cb

Browse files
authored
Update modify some descriptions
1 parent cac7b1a commit 4fe24cb

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

docs/java/Basis/final、static、this、super.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,13 @@ public class Sub extends Super {
9292

9393
**使用 this 和 super 要注意的问题:**
9494

95-
- super 调用父类中的其他构造方法时,调用时要放在构造方法的首行!this 调用本类中的其他构造方法时,也要放在首行。
95+
- 在构造器中使用 `super()` 调用父类中的其他构造方法时,该语句必须处于构造器的首行,否则编译器会报错。另外,this 调用本类中的其他构造方法时,也要放在首行。
9696
- this、super不能用在static方法中。
9797

9898
**简单解释一下:**
9999

100100
被 static 修饰的成员属于类,不属于单个这个类的某个对象,被类中所有对象共享。而 this 代表对本类对象的引用,指向本类对象;而 super 代表对父类对象的引用,指向父类对象;所以, **this和super是属于对象范畴的东西,而静态方法是属于类范畴的东西**
101101

102-
103-
104102
## 参考
105103

106104
- https://www.codejava.net/java-core/the-java-language/java-keywords

0 commit comments

Comments
 (0)