Skip to content
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

My zoo #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

My zoo #1

wants to merge 4 commits into from

Conversation

Yura1977
Copy link

@Yura1977 Yura1977 commented Sep 4, 2019

No description provided.

*/
public class App {
public static void main(String[] args) {
Zoo a1 = new Shark("Masanya_1");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yura1977 називай змінні більш зрозуміло

array1.add(a2);
array1.add(a3);
array1.add(a4);
ArrayList<Fish> array2 = new ArrayList<>();//Acvarium
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yura1977 Я очікую що тут буде класс Cage з дженериками, WildCard і т.д

//Flyableable[] array2 = { s1,s2, b1, m1, p1, l1};

for (Zoo a : array1) {
if (a instanceof Shark) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yura1977 Це взагалі фігня)

for (Zoo a : array1) {
if (a instanceof Shark) {
Shark m = (Shark) a;
System.out.println(m.name);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yura1977 p.name? А інкапсуляція? А Getters and Setters?

this.name = name;
}

abstract void eat();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yura1977 В зоопарку є метод їсти??? Серйозно?

}
}

abstract class Mammal extends Zoo implements Flyableable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yura1977 Mammal це самець? Якщо так . - то він має має імплементити Flyableable?

void swimable();
}
interface Flyableable{
default void flyable(){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yura1977 А ти впевнений що цей метод має бути дефолтним?

System.out.println(name + "Sparrow fly very well");
}
}
class Pingvin extends Bird implements Swimable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yura1977 А що відбудеться коли викличемо метод fly() у пінгвіна?

@Yura1977
Copy link
Author

Add changes.

@Yura1977 Yura1977 closed this Sep 16, 2019
@Yura1977 Yura1977 reopened this Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants