From 81947f9b29bd4c7b76acd0edace8d3864a291877 Mon Sep 17 00:00:00 2001 From: Oleksii Aleshchenko Date: Thu, 16 Feb 2023 16:10:38 +0200 Subject: [PATCH] add EncapsulationInheritancePolymorphism --- .idea/uiDesigner.xml | 124 ++++++++++++++++++ .idea/vcs.xml | 6 + src/Main.java | 1 + .../Encapsulation.java | 20 +++ .../EncapsulationInheritancePolymorphism.java | 10 ++ .../Student.java | 10 ++ 6 files changed, 171 insertions(+) create mode 100644 .idea/uiDesigner.xml create mode 100644 .idea/vcs.xml create mode 100644 src/encapsulationInheritancePolymorphism/Encapsulation.java create mode 100644 src/encapsulationInheritancePolymorphism/EncapsulationInheritancePolymorphism.java create mode 100644 src/encapsulationInheritancePolymorphism/Student.java diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/Main.java b/src/Main.java index c2a31e9..6c19da8 100644 --- a/src/Main.java +++ b/src/Main.java @@ -1,5 +1,6 @@ public class Main { public static void main(String[] args) { + System.out.println(args[1]); System.out.println("Hello world!"); // System.out.println(1); } diff --git a/src/encapsulationInheritancePolymorphism/Encapsulation.java b/src/encapsulationInheritancePolymorphism/Encapsulation.java new file mode 100644 index 0000000..aa53da3 --- /dev/null +++ b/src/encapsulationInheritancePolymorphism/Encapsulation.java @@ -0,0 +1,20 @@ +package encapsulationInheritancePolymorphism; + +public class Encapsulation { + /*private*/ int field; + private int field2; +// int a = 1; + + public void myMethodForTheField () { + System.out.println(field); + } + + public void myMethodForTheField2 () { + System.out.println(field); + } + + public void myMethodForTheFieldAndTheField2 () { + System.out.println(field); + } +} + diff --git a/src/encapsulationInheritancePolymorphism/EncapsulationInheritancePolymorphism.java b/src/encapsulationInheritancePolymorphism/EncapsulationInheritancePolymorphism.java new file mode 100644 index 0000000..b7343df --- /dev/null +++ b/src/encapsulationInheritancePolymorphism/EncapsulationInheritancePolymorphism.java @@ -0,0 +1,10 @@ +package encapsulationInheritancePolymorphism; + +public class EncapsulationInheritancePolymorphism { + + public static void main(String[] args) { + int a = 1; +// var b = 2; +// System.out.println(b); + } +} diff --git a/src/encapsulationInheritancePolymorphism/Student.java b/src/encapsulationInheritancePolymorphism/Student.java new file mode 100644 index 0000000..8d931b9 --- /dev/null +++ b/src/encapsulationInheritancePolymorphism/Student.java @@ -0,0 +1,10 @@ +package encapsulationInheritancePolymorphism; + +public class Student { + private String name; + private String surname; + + public String getName() { + return name; + } +}