Skip to content

Commit

Permalink
Update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
HunorVadaszPerhat authored Apr 18, 2023
1 parent e57742a commit 2134a85
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions super/readme.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
## Super

- [Calling a superclass constructor](#calling-a-superclass-constructor)
- [Accessing method and variable of superclass](#accessing-method-and-variable-of-superclass)

### Calling a superclass constructor
- can call a constructor in the superclass of the current class
- often used in constructor chaining, where there are multiple constructors in a class that call each other using this(), and the final constructor calls a constructor in the superclass using super()

![Super call constructor](https://github.com/HunorVadaszPerhat/java_lang_specs/blob/main/images/super_call_constructor.png)

### Accessing method and variable of superclass
- can access methods or variables in the superclass of the current class
- useful when there is a method or variable with the same name in both the superclass and subclass and the one in the superclass should be referred to

![Accessing method and variable of superclass](https://github.com/HunorVadaszPerhat/java_lang_specs/blob/main/images/access_superclass_method_variable.png)

0 comments on commit 2134a85

Please sign in to comment.