-
Notifications
You must be signed in to change notification settings - Fork 3
All tasks #1
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
base: master
Are you sure you want to change the base?
All tasks #1
Conversation
|
| private int age; | ||
| private int size; | ||
| private String color; | ||
| public static final int CONST = 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this is needed?
| package javaTraining.module3; | ||
|
|
||
| class Elephant extends Animal{ | ||
| String name = "Elephant"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fields should always have access modifiers!
|
|
||
| Elephant(String name, int age, int size, String color) { | ||
| super(name, age, size, color); | ||
| this.name = name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you are setting fields in Parent class, then it will also belong to child class. There is no need in setting child class fields and parent class fields
|
|
||
| Lion(String name, int age, int size, String color) { | ||
| super(name, age, size, color); | ||
| this.name = name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same issue as for Elephant clas
| @@ -0,0 +1,7 @@ | |||
| package javaTraining.module4; | |||
|
|
|||
| public class WashingPlace { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why interface is inside of another class?
|
|
||
|
|
||
|
|
||
| class Animal extends Object{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All classes in Java are extended from Object by default, hence no sense explicitly specifying it
|
|
||
| } | ||
|
|
||
| //Method Overriding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not to use @OverRide annotation?
No description provided.