Skip to content

Commit 15dd97b

Browse files
Egima profilepivovarit
authored andcommitted
removed redundant makeSound sound method of abstract class Animal (eugenp#668)
* made changes to java reflection * removed redundant method makeSound in Animal abstract class
1 parent fc1bb6b commit 15dd97b

2 files changed

Lines changed: 1 addition & 5 deletions

File tree

‎core-java/src/main/java/com/baeldung/java/reflection/Animal.java‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ public void setName(String name) {
1818
this.name = name;
1919
}
2020

21-
public String makeSound() {
22-
return getSound();
23-
}
24-
2521
protected abstract String getSound();
2622

2723
}

‎core-java/src/test/java/com/baeldung/java/reflection/ReflectionTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public void givenClass_whenGetsMethods_thenCorrect()
124124

125125
assertEquals(4, actualMethods.size());
126126
assertTrue(actualMethods.containsAll(Arrays.asList("getName",
127-
"setName", "getSound", "makeSound")));
127+
"setName", "getSound")));
128128
}
129129

130130
@Test

0 commit comments

Comments
 (0)