diff --git a/src/encapsulationInheritancePolymorphism/Main.java b/src/encapsulationInheritancePolymorphism/Main.java new file mode 100644 index 0000000..47dc9d3 --- /dev/null +++ b/src/encapsulationInheritancePolymorphism/Main.java @@ -0,0 +1,14 @@ +package encapsulationInheritancePolymorphism; + +public class Main { + public static void main(String[] args) { + Student student = new Student(); + + + + + //... + + student.setFaculty("FPM", "MO-22"); + } +} diff --git a/src/encapsulationInheritancePolymorphism/Student.java b/src/encapsulationInheritancePolymorphism/Student.java index 8d931b9..2ad836d 100644 --- a/src/encapsulationInheritancePolymorphism/Student.java +++ b/src/encapsulationInheritancePolymorphism/Student.java @@ -3,8 +3,16 @@ package encapsulationInheritancePolymorphism; public class Student { private String name; private String surname; + private String group; + private String faculty; + public String getName() { return name; } + + public void setFaculty(String faculty, String group) { + this.faculty = faculty; + this.group = group; + } } diff --git a/src/test/A.java b/src/test/A.java new file mode 100644 index 0000000..8553a5e --- /dev/null +++ b/src/test/A.java @@ -0,0 +1,13 @@ +package test; + +public class A { + /*private*/ int f/* = 3*/; + + public int getF() { + return f; + } + + public void setF(int f) { + this.f = f; + } +} diff --git a/src/test/Main.java b/src/test/Main.java new file mode 100644 index 0000000..bf9f4b3 --- /dev/null +++ b/src/test/Main.java @@ -0,0 +1,15 @@ +package test; + +public class Main { + public static void main(String[] args) { + A a = new A(); + System.out.println(a.getF()); + a.setF(1); + System.out.println(a.getF()); + + System.out.println(a.f); + + int[] array = {1, 2, 1}; + System.out.println(array.length); + } +}