diff --git a/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/README.md b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/README.md
new file mode 100644
index 0000000000..d3909c0014
--- /dev/null
+++ b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/README.md
@@ -0,0 +1,8 @@
+## Core Java Lang OOP - Others
+
+This module contains articles about Object Oriented Programming (OOP) in Java
+
+### Relevant Articles:
+- [Object-Oriented-Programming Concepts in Java](https://www.baeldung.com/java-oop)
+- [Static and Dynamic Binding in Java](https://www.baeldung.com/java-static-dynamic-binding)
+- [Pass-By-Value as a Parameter Passing Mechanism in Java](https://www.baeldung.com/java-pass-by-value-or-pass-by-reference)
diff --git a/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/pom.xml b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/pom.xml
new file mode 100644
index 0000000000..21699cd582
--- /dev/null
+++ b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/pom.xml
@@ -0,0 +1,16 @@
+
+
+
+ core-java-lang-oop-modules
+ com.baeldung.core-java-lang-oop-modules
+ 1.0.0-SNAPSHOT
+
+ 4.0.0
+
+ core-java-lang-oop-others
+ core-java-lang-oop-others
+ jar
+
+
\ No newline at end of file
diff --git a/core-java-modules/core-java-lang-oop-4/src/main/java/com/baeldung/binding/Animal.java b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/binding/Animal.java
similarity index 100%
rename from core-java-modules/core-java-lang-oop-4/src/main/java/com/baeldung/binding/Animal.java
rename to core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/binding/Animal.java
diff --git a/core-java-modules/core-java-lang-oop-4/src/main/java/com/baeldung/binding/AnimalActivity.java b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/binding/AnimalActivity.java
similarity index 90%
rename from core-java-modules/core-java-lang-oop-4/src/main/java/com/baeldung/binding/AnimalActivity.java
rename to core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/binding/AnimalActivity.java
index 1bd36123e3..a30c3acd00 100644
--- a/core-java-modules/core-java-lang-oop-4/src/main/java/com/baeldung/binding/AnimalActivity.java
+++ b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/binding/AnimalActivity.java
@@ -15,7 +15,7 @@ public class AnimalActivity {
logger.info("Animal is sleeping");
}
- public static void sleep(Cat cat) {
+ public static void sleep(Dog dog) {
logger.info("Cat is sleeping");
}
@@ -30,7 +30,7 @@ public class AnimalActivity {
//assigning a dog object to reference of type Animal
- Animal catAnimal = new Cat();
+ Animal catAnimal = new Dog();
catAnimal.makeNoise();
diff --git a/core-java-modules/core-java-lang-oop-4/src/main/java/com/baeldung/binding/Cat.java b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/binding/Dog.java
similarity index 68%
rename from core-java-modules/core-java-lang-oop-4/src/main/java/com/baeldung/binding/Cat.java
rename to core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/binding/Dog.java
index bbe740e412..b6924569d0 100644
--- a/core-java-modules/core-java-lang-oop-4/src/main/java/com/baeldung/binding/Cat.java
+++ b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/binding/Dog.java
@@ -6,9 +6,9 @@ import org.slf4j.LoggerFactory;
/**
* Created by madhumita.g on 25-07-2018.
*/
-public class Cat extends Animal {
+public class Dog extends Animal {
- final static Logger logger = LoggerFactory.getLogger(Cat.class);
+ final static Logger logger = LoggerFactory.getLogger(Dog.class);
public void makeNoise() {
diff --git a/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/oop/ArmoredCar.java b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/oop/ArmoredCar.java
new file mode 100644
index 0000000000..29cba3702a
--- /dev/null
+++ b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/oop/ArmoredCar.java
@@ -0,0 +1,13 @@
+package com.baeldung.oop;
+
+public class ArmoredCar extends Car {
+ private int bulletProofWindows;
+
+ public ArmoredCar(String type, String model, String color) {
+ super(type, model, color);
+ }
+
+ public void remoteStartCar() {
+ // this vehicle can be started by using a remote control
+ }
+}
diff --git a/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/oop/Car.java b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/oop/Car.java
new file mode 100644
index 0000000000..8ea4d779b6
--- /dev/null
+++ b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/oop/Car.java
@@ -0,0 +1,58 @@
+package com.baeldung.oop;
+
+public class Car extends Vehicle {
+
+ private String type;
+ private String color;
+ private int speed;
+ private int numberOfGears;
+
+ public Car(String type, String model, String color) {
+ super(4, model);
+ this.type = type;
+ this.color = color;
+ }
+
+ public String getColor() {
+ return color;
+ }
+
+ public void setColor(String color) {
+ this.color = color;
+ }
+
+ public int getSpeed() {
+ return speed;
+ }
+
+ public void setSpeed(int speed) {
+ this.speed = speed;
+ }
+
+ public int increaseSpeed(int increment) {
+ if (increment > 0) {
+ this.speed += increment;
+ } else {
+ System.out.println("Increment can't be negative.");
+ }
+ return this.speed;
+ }
+
+ public int decreaseSpeed(int decrement) {
+ if (decrement > 0 && decrement <= this.speed) {
+ this.speed -= decrement;
+ } else {
+ System.out.println("Decrement can't be negative or greater than current speed.");
+ }
+ return this.speed;
+ }
+
+ public void openDoors() {
+ // process to open the doors
+ }
+
+ @Override
+ public void honk() {
+ // produces car-specific honk
+ }
+}
diff --git a/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/oop/GenericFile.java b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/oop/GenericFile.java
new file mode 100644
index 0000000000..812a3f1d63
--- /dev/null
+++ b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/oop/GenericFile.java
@@ -0,0 +1,63 @@
+package com.baeldung.oop;
+
+import java.util.Date;
+
+public class GenericFile {
+ private String name;
+ private String extension;
+ private Date dateCreated;
+ private String version;
+ private byte[] content;
+
+ public GenericFile() {
+ this.setDateCreated(new Date());
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getExtension() {
+ return extension;
+ }
+
+ public void setExtension(String extension) {
+ this.extension = extension;
+ }
+
+ public Date getDateCreated() {
+ return dateCreated;
+ }
+
+ public void setDateCreated(Date dateCreated) {
+ this.dateCreated = dateCreated;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public byte[] getContent() {
+ return content;
+ }
+
+ public void setContent(byte[] content) {
+ this.content = content;
+ }
+
+ public String getFileInfo() {
+ return "Generic File Impl";
+ }
+
+ public Object read() {
+ return content;
+ }
+}
diff --git a/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/oop/ImageFile.java b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/oop/ImageFile.java
new file mode 100644
index 0000000000..2e2b9b4129
--- /dev/null
+++ b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/oop/ImageFile.java
@@ -0,0 +1,41 @@
+package com.baeldung.oop;
+
+public class ImageFile extends GenericFile {
+ private int height;
+ private int width;
+
+ public ImageFile(String name, int height, int width, byte[] content, String version) {
+ this.setHeight(height);
+ this.setWidth(width);
+ this.setContent(content);
+ this.setName(name);
+ this.setVersion(version);
+ this.setExtension(".jpg");
+ }
+
+ public int getHeight() {
+ return height;
+ }
+
+ public void setHeight(int height) {
+ this.height = height;
+ }
+
+ public int getWidth() {
+ return width;
+ }
+
+ public void setWidth(int width) {
+ this.width = width;
+ }
+
+ public String getFileInfo() {
+ return "Image File Impl";
+ }
+
+ public String read() {
+ return this.getContent()
+ .toString();
+ }
+
+}
diff --git a/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/oop/TextFile.java b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/oop/TextFile.java
new file mode 100644
index 0000000000..0d7b8e4192
--- /dev/null
+++ b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/oop/TextFile.java
@@ -0,0 +1,44 @@
+package com.baeldung.oop;
+
+public class TextFile extends GenericFile {
+ private int wordCount;
+
+ public TextFile(String name, String content, String version) {
+ String[] words = content.split(" ");
+ this.setWordCount(words.length > 0 ? words.length : 1);
+ this.setContent(content.getBytes());
+ this.setName(name);
+ this.setVersion(version);
+ this.setExtension(".txt");
+ }
+
+ public int getWordCount() {
+ return wordCount;
+ }
+
+ public void setWordCount(int wordCount) {
+ this.wordCount = wordCount;
+ }
+
+ public String getFileInfo() {
+ return "Text File Impl";
+ }
+
+ public String read() {
+ return this.getContent()
+ .toString();
+ }
+
+ public String read(int limit) {
+ return this.getContent()
+ .toString()
+ .substring(0, limit);
+ }
+
+ public String read(int start, int stop) {
+ return this.getContent()
+ .toString()
+ .substring(start, stop);
+ }
+
+}
diff --git a/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/oop/Vehicle.java b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/oop/Vehicle.java
new file mode 100644
index 0000000000..d5ef05bc31
--- /dev/null
+++ b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/oop/Vehicle.java
@@ -0,0 +1,23 @@
+package com.baeldung.oop;
+
+public class Vehicle {
+ private int wheels;
+ private String model;
+
+ public Vehicle(int wheels, String model) {
+ this.wheels = wheels;
+ this.model = model;
+ }
+
+ public void start() {
+ // the process of starting the vehicle
+ }
+
+ public void stop() {
+ // process to stop the vehicle
+ }
+
+ public void honk() {
+ // produces a default honk
+ }
+}
diff --git a/core-java-modules/core-java-lang-oop-3/src/main/java/com/baeldung/parameterpassing/NonPrimitives.java b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/parameterpassing/NonPrimitives.java
similarity index 100%
rename from core-java-modules/core-java-lang-oop-3/src/main/java/com/baeldung/parameterpassing/NonPrimitives.java
rename to core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/parameterpassing/NonPrimitives.java
diff --git a/core-java-modules/core-java-lang-oop-3/src/main/java/com/baeldung/parameterpassing/Primitives.java b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/parameterpassing/Primitives.java
similarity index 100%
rename from core-java-modules/core-java-lang-oop-3/src/main/java/com/baeldung/parameterpassing/Primitives.java
rename to core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/main/java/com/baeldung/parameterpassing/Primitives.java
diff --git a/core-java-modules/core-java-lang-oop-4/src/test/java/com/baeldung/binding/AnimalActivityUnitTest.java b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/test/java/com/baeldung/binding/AnimalActivityUnitTest.java
similarity index 96%
rename from core-java-modules/core-java-lang-oop-4/src/test/java/com/baeldung/binding/AnimalActivityUnitTest.java
rename to core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/test/java/com/baeldung/binding/AnimalActivityUnitTest.java
index 41c67ff389..6ef9b51818 100644
--- a/core-java-modules/core-java-lang-oop-4/src/test/java/com/baeldung/binding/AnimalActivityUnitTest.java
+++ b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/test/java/com/baeldung/binding/AnimalActivityUnitTest.java
@@ -62,9 +62,9 @@ public class AnimalActivityUnitTest {
@Test
public void givenDogReference__whenRefersCatObject_shouldCallFunctionWithAnimalParam() {
- Cat cat = new Cat();
+ Dog dog = new Dog();
- AnimalActivity.sleep(cat);
+ AnimalActivity.sleep(dog);
verify(mockAppender).doAppend(captorLoggingEvent.capture());
@@ -79,7 +79,7 @@ public class AnimalActivityUnitTest {
@Test
public void givenAnimaReference__whenRefersDogObject_shouldCallFunctionWithAnimalParam() {
- Animal cat = new Cat();
+ Animal cat = new Dog();
AnimalActivity.sleep(cat);
diff --git a/core-java-modules/core-java-lang-oop-4/src/test/java/com/baeldung/binding/AnimalUnitTest.java b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/test/java/com/baeldung/binding/AnimalUnitTest.java
similarity index 100%
rename from core-java-modules/core-java-lang-oop-4/src/test/java/com/baeldung/binding/AnimalUnitTest.java
rename to core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/test/java/com/baeldung/binding/AnimalUnitTest.java
diff --git a/core-java-modules/core-java-lang-oop-4/src/test/java/com/baeldung/binding/CatUnitTest.java b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/test/java/com/baeldung/binding/DogUnitTest.java
similarity index 94%
rename from core-java-modules/core-java-lang-oop-4/src/test/java/com/baeldung/binding/CatUnitTest.java
rename to core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/test/java/com/baeldung/binding/DogUnitTest.java
index 76ccfb7719..977c5d65e6 100644
--- a/core-java-modules/core-java-lang-oop-4/src/test/java/com/baeldung/binding/CatUnitTest.java
+++ b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/test/java/com/baeldung/binding/DogUnitTest.java
@@ -22,7 +22,7 @@ import static org.mockito.Mockito.verify;
* Created by madhumita.g on 01-08-2018.
*/
@RunWith(MockitoJUnitRunner.class)
-public class CatUnitTest {
+public class DogUnitTest {
@Mock
private Appender mockAppender;
@@ -45,9 +45,9 @@ public class CatUnitTest {
@Test
public void makeNoiseTest() {
- Cat cat = new Cat();
+ Dog dog = new Dog();
- cat.makeNoise();
+ dog.makeNoise();
verify(mockAppender).doAppend(captorLoggingEvent.capture());
diff --git a/core-java-modules/core-java-lang-oop-3/src/test/java/com/baeldung/parameterpassing/NonPrimitivesUnitTest.java b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/test/java/com/baeldung/parameterpassing/NonPrimitivesUnitTest.java
similarity index 100%
rename from core-java-modules/core-java-lang-oop-3/src/test/java/com/baeldung/parameterpassing/NonPrimitivesUnitTest.java
rename to core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/test/java/com/baeldung/parameterpassing/NonPrimitivesUnitTest.java
diff --git a/core-java-modules/core-java-lang-oop-3/src/test/java/com/baeldung/parameterpassing/PrimitivesUnitTest.java b/core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/test/java/com/baeldung/parameterpassing/PrimitivesUnitTest.java
similarity index 100%
rename from core-java-modules/core-java-lang-oop-3/src/test/java/com/baeldung/parameterpassing/PrimitivesUnitTest.java
rename to core-java-modules/core-java-lang-oop-modules/core-java-lang-oop-others/src/test/java/com/baeldung/parameterpassing/PrimitivesUnitTest.java
diff --git a/core-java-modules/core-java-lang-oop-modules/pom.xml b/core-java-modules/core-java-lang-oop-modules/pom.xml
index 369195d477..39dfe16b17 100644
--- a/core-java-modules/core-java-lang-oop-modules/pom.xml
+++ b/core-java-modules/core-java-lang-oop-modules/pom.xml
@@ -22,5 +22,6 @@
core-java-lang-oop-types
core-java-lang-oop-inheritance
core-java-lang-oop-methods
+ core-java-lang-oop-others
\ No newline at end of file
diff --git a/core-java-modules/core-java-lang-oop/README.md b/core-java-modules/core-java-lang-oop/README.md
index f7e00e44eb..1af957b532 100644
--- a/core-java-modules/core-java-lang-oop/README.md
+++ b/core-java-modules/core-java-lang-oop/README.md
@@ -5,5 +5,4 @@ This module contains articles about Object-oriented programming (OOP) in Java
### Relevant Articles:
- [How to Make a Deep Copy of an Object in Java](https://www.baeldung.com/java-deep-copy)
- [Type Erasure in Java Explained](https://www.baeldung.com/java-type-erasure)
-- [Object-Oriented-Programming Concepts in Java](https://www.baeldung.com/java-oop)
- [[More -->]](/core-java-modules/core-java-lang-oop-2)