Last active
May 9, 2023 05:46
-
-
Save orvyl/4f5ff069ca22074169a9f33cdf9836c0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package zoo; | |
import zoo.person.Manager; | |
public class ZooApp { | |
public static void main(String[] args) { | |
Manager manager1 = new Manager("Manager 1"); | |
manager1.setName("Orvyl"); | |
manager1.setAge(12); | |
System.out.println(manager1.getName()); | |
} | |
} | |
==== | |
package zoo.person; | |
public class Human { | |
private String name; | |
private int age; | |
public String getName() { | |
return name; | |
} | |
public void setName(String name) { | |
this.name = name; | |
} | |
public int getAge() { | |
return age; | |
} | |
public void setAge(int age) { | |
this.age = age; | |
} | |
} | |
=== | |
package zoo.person; | |
public class Visitor extends Human { | |
public int getAge() { | |
return super.getAge(); | |
} | |
} | |
==== | |
package zoo.person; | |
public class Manager extends Human { | |
String title; | |
public Manager(String title) { | |
this.title = title; | |
} | |
} | |
==== | |
package zoo.person; | |
import zoo.Animal; | |
public class Employee extends Human { | |
double salary; | |
void feedAnimal(Animal animal) { | |
animal.chewFood(); | |
} | |
} | |
===== | |
package zoo; | |
public class Animal { | |
String name; | |
String type; | |
String food; | |
void produceSound() { | |
} | |
public void chewFood() { | |
} | |
} | |
===== | |
Map<String, String> users = new HashMap<>(); | |
users.put("09175861661", "Orvyl"); | |
users.put("09175861662", "Maria"); | |
users.put("09175861665", "Jobo"); | |
System.out.println(users.get("09175861661")); | |
System.out.println(users.get("09175861662")); | |
System.out.println(users.get("09175821661")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment