mirror of
https://github.com/Xevion/contest.git
synced 2025-12-07 13:14:44 -06:00
more info on class super() invoke
This commit is contained in:
@@ -404,7 +404,16 @@ A obj = new B();
|
||||
|
||||
Here, it would be normal to assume that it simply prints a asterisk.
|
||||
|
||||
But really,
|
||||
But, as one should know, Java inserts a no-argument `super()` call to the superclass *if one is not **explicitly** invoked* inside the subclass constructor.
|
||||
|
||||
Behind the scenes, `B`'s constructor really behaves like this:
|
||||
|
||||
```java
|
||||
B() {
|
||||
super()
|
||||
out.println("*");
|
||||
}
|
||||
```
|
||||
|
||||
### List.remove() Element Shifting
|
||||
|
||||
|
||||
Reference in New Issue
Block a user