diff --git a/Examples/workshop_6/.idea/.gitignore b/Examples/workshop_6/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/Examples/workshop_6/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/Examples/workshop_6/.idea/example.iml b/Examples/workshop_6/.idea/example.iml new file mode 100644 index 0000000..b107a2d --- /dev/null +++ b/Examples/workshop_6/.idea/example.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Examples/workshop_6/.idea/misc.xml b/Examples/workshop_6/.idea/misc.xml new file mode 100644 index 0000000..106ec0f --- /dev/null +++ b/Examples/workshop_6/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Examples/workshop_6/.idea/modules.xml b/Examples/workshop_6/.idea/modules.xml new file mode 100644 index 0000000..2a37e8d --- /dev/null +++ b/Examples/workshop_6/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Examples/workshop_6/A.java b/Examples/workshop_6/A.java new file mode 100644 index 0000000..fb8d9c5 --- /dev/null +++ b/Examples/workshop_6/A.java @@ -0,0 +1,36 @@ +public class A extends B{ + private int aInt; + public A(int aInt, int bInt) { + super(bInt); + this.aInt = aInt; + } + + @Override + public void show(){ + System.out.println("salam a"); + } + + public static void main(String[] args) { +// A a = new A(10, 20); +// if(a instanceof A){ +// System.out.println("yes a is instanceof A"); +// } +// if(a instanceof B){ +// System.out.println("yes a is instanceof B"); +// } +// B b = new B(100); +// if(!(b instanceof A)){ +// System.out.println("yes b isn't instanceof A"); +// } +// B c = null; +// if(!(c instanceof B)){ +// System.out.println("yes null isn't instanceof B"); +// } +// B obj1 = new A(5, 5); +// A objA1 = (A)obj1; +// B obj2 = new B(10); +// A objA2 = (A)obj2; + A test = new A(1, 2); + test.show(); + } +} diff --git a/Examples/workshop_6/B.java b/Examples/workshop_6/B.java new file mode 100644 index 0000000..819f9e5 --- /dev/null +++ b/Examples/workshop_6/B.java @@ -0,0 +1,11 @@ +public class B { + private int bInt; + + public B(int bInt) { + this.bInt = bInt; + } + + public void show(){ + System.out.println("salam b"); + } +} diff --git a/Examples/workshop_6/out/production/example/.idea/.gitignore b/Examples/workshop_6/out/production/example/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/Examples/workshop_6/out/production/example/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/Examples/workshop_6/out/production/example/.idea/example.iml b/Examples/workshop_6/out/production/example/.idea/example.iml new file mode 100644 index 0000000..b107a2d --- /dev/null +++ b/Examples/workshop_6/out/production/example/.idea/example.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Examples/workshop_6/out/production/example/.idea/misc.xml b/Examples/workshop_6/out/production/example/.idea/misc.xml new file mode 100644 index 0000000..106ec0f --- /dev/null +++ b/Examples/workshop_6/out/production/example/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Examples/workshop_6/out/production/example/.idea/modules.xml b/Examples/workshop_6/out/production/example/.idea/modules.xml new file mode 100644 index 0000000..2a37e8d --- /dev/null +++ b/Examples/workshop_6/out/production/example/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Practice_codes/workshop_6/.idea/.gitignore b/Practice_codes/workshop_6/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/Practice_codes/workshop_6/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/Practice_codes/workshop_6/.idea/misc.xml b/Practice_codes/workshop_6/.idea/misc.xml new file mode 100644 index 0000000..106ec0f --- /dev/null +++ b/Practice_codes/workshop_6/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Practice_codes/workshop_6/.idea/modules.xml b/Practice_codes/workshop_6/.idea/modules.xml new file mode 100644 index 0000000..afe3066 --- /dev/null +++ b/Practice_codes/workshop_6/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Practice_codes/workshop_6/.idea/vcs.xml b/Practice_codes/workshop_6/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/Practice_codes/workshop_6/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Practice_codes/workshop_6/WorkShop6/.idea/misc.xml b/Practice_codes/workshop_6/WorkShop6/.idea/misc.xml new file mode 100644 index 0000000..a2c4e58 --- /dev/null +++ b/Practice_codes/workshop_6/WorkShop6/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Practice_codes/workshop_6/WorkShop6/.idea/modules.xml b/Practice_codes/workshop_6/WorkShop6/.idea/modules.xml new file mode 100644 index 0000000..54d277a --- /dev/null +++ b/Practice_codes/workshop_6/WorkShop6/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Practice_codes/workshop_6/WorkShop6/.idea/vcs.xml b/Practice_codes/workshop_6/WorkShop6/.idea/vcs.xml new file mode 100644 index 0000000..288b36b --- /dev/null +++ b/Practice_codes/workshop_6/WorkShop6/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Practice_codes/workshop_6/WorkShop6/.idea/workspace.xml b/Practice_codes/workshop_6/WorkShop6/.idea/workspace.xml new file mode 100644 index 0000000..01632d7 --- /dev/null +++ b/Practice_codes/workshop_6/WorkShop6/.idea/workspace.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + 1743277830651 + + + + + + \ No newline at end of file diff --git a/Practice_codes/workshop_6/WorkShop6/WorkShop6.iml b/Practice_codes/workshop_6/WorkShop6/WorkShop6.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/Practice_codes/workshop_6/WorkShop6/WorkShop6.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Practice_codes/workshop_6/WorkShop6/src/Animal.java b/Practice_codes/workshop_6/WorkShop6/src/Animal.java new file mode 100644 index 0000000..f359db7 --- /dev/null +++ b/Practice_codes/workshop_6/WorkShop6/src/Animal.java @@ -0,0 +1,13 @@ +public abstract class Animal { + protected String name; + protected int age; + protected String special; + + public Animal(String name, int age, String special) { + this.name = name; + this.age = age; + this.special = special; + } + + public abstract void show(); +} diff --git a/Practice_codes/workshop_6/WorkShop6/src/Bird.java b/Practice_codes/workshop_6/WorkShop6/src/Bird.java new file mode 100644 index 0000000..adba3c8 --- /dev/null +++ b/Practice_codes/workshop_6/WorkShop6/src/Bird.java @@ -0,0 +1,8 @@ +public abstract class Bird extends Animal{ + protected int heightOfFly; + + public Bird(String name, int age, String special, int heightOfFly) { + super(name, age, special); + this.heightOfFly = heightOfFly; + } +} diff --git a/Practice_codes/workshop_6/WorkShop6/src/Cheetah.java b/Practice_codes/workshop_6/WorkShop6/src/Cheetah.java new file mode 100644 index 0000000..da611e0 --- /dev/null +++ b/Practice_codes/workshop_6/WorkShop6/src/Cheetah.java @@ -0,0 +1,16 @@ +public class Cheetah extends Mammal implements Hunter{ + public Cheetah(String name, int age, String special, int speedOfRunning) { + super(name, age, special, speedOfRunning); + } + + @Override + public void hunt(Prey prey) { + System.out.println(name + " hunted " + prey.getName()); + } + + @Override + public void show() { + System.out.println("Name : " + name + " Age : " + age + " Speed of running : " + speedOfRunning + + " special : " + special); + } +} diff --git a/Practice_codes/workshop_6/WorkShop6/src/Eagle.java b/Practice_codes/workshop_6/WorkShop6/src/Eagle.java new file mode 100644 index 0000000..beaa587 --- /dev/null +++ b/Practice_codes/workshop_6/WorkShop6/src/Eagle.java @@ -0,0 +1,16 @@ +public class Eagle extends Bird implements Hunter{ + public Eagle(String name, int age, String special, int heightOfFly) { + super(name, age, special, heightOfFly); + } + + @Override + public void hunt(Prey prey) { + System.out.println(name + " hunted " + prey.getName()); + } + + @Override + public void show() { + System.out.println("Name : " + name + " Age : " + age + " Hight of fly : " + heightOfFly + + " special : " + special); + } +} diff --git a/Practice_codes/workshop_6/WorkShop6/src/Girafe.java b/Practice_codes/workshop_6/WorkShop6/src/Girafe.java new file mode 100644 index 0000000..2781d79 --- /dev/null +++ b/Practice_codes/workshop_6/WorkShop6/src/Girafe.java @@ -0,0 +1,17 @@ +public class Girafe extends Mammal implements Prey{ + public Girafe(String name, int age, String special, int speedOfRunning) { + super(name, age, special, speedOfRunning); + } + + @Override + public String getName() { + return name; + } + + @Override + public void show() { + System.out.println("Name : " + name + " Age : " + age + " Speed of running : " + speedOfRunning + + " special : " + special); + } + +} diff --git a/Practice_codes/workshop_6/WorkShop6/src/Hunter.java b/Practice_codes/workshop_6/WorkShop6/src/Hunter.java new file mode 100644 index 0000000..539ad2c --- /dev/null +++ b/Practice_codes/workshop_6/WorkShop6/src/Hunter.java @@ -0,0 +1,5 @@ +import java.security.PublicKey; + +public interface Hunter { + public void hunt(Prey prey); +} diff --git a/Practice_codes/workshop_6/WorkShop6/src/Main.java b/Practice_codes/workshop_6/WorkShop6/src/Main.java new file mode 100644 index 0000000..ddf1d02 --- /dev/null +++ b/Practice_codes/workshop_6/WorkShop6/src/Main.java @@ -0,0 +1,23 @@ +import java.util.ArrayList; + +public class Main { + public static void main(String[] args) { + ArrayList arr = new ArrayList<>(); + Parrot parrot = new Parrot("parrot1", 10, "sp", 100); + Cheetah cheetah = new Cheetah("cheetah1", 4, "sp2", 200); + Eagle eagle = new Eagle("eagle1", 3, "sp3", 182); + Girafe girafe = new Girafe("girafe1", 32, "sp4", 12); + arr.add(parrot); + arr.add(cheetah); + arr.add(eagle); + arr.add(girafe); + int idx = 0; + for(Animal animal : arr){ + System.out.printf("row : " + idx + " "); + animal.show(); + idx ++; + } + cheetah.hunt(girafe); + eagle.hunt(parrot); + } +} \ No newline at end of file diff --git a/Practice_codes/workshop_6/WorkShop6/src/Mammal.java b/Practice_codes/workshop_6/WorkShop6/src/Mammal.java new file mode 100644 index 0000000..bfa37db --- /dev/null +++ b/Practice_codes/workshop_6/WorkShop6/src/Mammal.java @@ -0,0 +1,8 @@ +public abstract class Mammal extends Animal { + protected int speedOfRunning; + + public Mammal(String name, int age, String special, int speedOfRunning) { + super(name, age, special); + this.speedOfRunning = speedOfRunning; + } +} diff --git a/Practice_codes/workshop_6/WorkShop6/src/Parrot.java b/Practice_codes/workshop_6/WorkShop6/src/Parrot.java new file mode 100644 index 0000000..7d8d6ee --- /dev/null +++ b/Practice_codes/workshop_6/WorkShop6/src/Parrot.java @@ -0,0 +1,17 @@ +public class Parrot extends Bird implements Prey{ + public Parrot(String name, int age, String special, int heightOfFly) { + super(name, age, special, heightOfFly); + } + + @Override + public String getName() { + return name; + } + + @Override + public void show() { + System.out.println("Name : " + name + " Age : " + age + " Hight of fly : " + heightOfFly + + " special : " + special); + } + +} diff --git a/Practice_codes/workshop_6/WorkShop6/src/Prey.java b/Practice_codes/workshop_6/WorkShop6/src/Prey.java new file mode 100644 index 0000000..876fa3d --- /dev/null +++ b/Practice_codes/workshop_6/WorkShop6/src/Prey.java @@ -0,0 +1,3 @@ +public interface Prey { + public String getName(); +} diff --git a/Practice_codes/workshop_6/workshop6_tamrin.iml b/Practice_codes/workshop_6/workshop6_tamrin.iml new file mode 100644 index 0000000..ec4a307 --- /dev/null +++ b/Practice_codes/workshop_6/workshop6_tamrin.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Slides/workshop_6/WorkShop6 .pptx b/Slides/workshop_6/WorkShop6 .pptx new file mode 100644 index 0000000..c4751a1 Binary files /dev/null and b/Slides/workshop_6/WorkShop6 .pptx differ