add EncapsulationInheritancePolymorphism

This commit is contained in:
Oleksii Aleshchenko
2023-02-16 16:10:38 +02:00
parent f4fbabe6e5
commit 81947f9b29
6 changed files with 171 additions and 0 deletions

View File

@@ -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);
}
}