Skip to content

Commit 3bace63

Browse files
committed
Correct downcast and upcast method names.
1 parent 2761cae commit 3bace63

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎koans/src/beginner/AboutCasting.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public String complain() {
5858
}
5959

6060
@Koan
61-
public void downCastWithInheritance() {
61+
public void upcastWithInheritance() {
6262
Child child = new Child();
6363
Parent parentReference = child; // Why isn't there an explicit cast?
6464
assertEquals(child instanceof Child, __);
@@ -68,15 +68,15 @@ public void downCastWithInheritance() {
6868
}
6969

7070
@Koan
71-
public void downCastAndPolymorphism() {
71+
public void upcastAndPolymorphism() {
7272
Child child = new Child();
7373
Parent parentReference = child;
7474
// If the result is unexpected, consider the difference between an instance and its reference
7575
assertEquals(parentReference.complain(), __);
7676
}
7777

7878
@Koan
79-
public void upCastWithInheritance() {
79+
public void downcastWithInheritance() {
8080
Grandparent child = new Child();
8181
Parent parentReference = (Parent) child; // Why do we need an explicit cast here?
8282
Child childReference = (Child) parentReference; // Or here?
@@ -86,7 +86,7 @@ public void upCastWithInheritance() {
8686
}
8787

8888
@Koan
89-
public void upCastAndPolymorphism() {
89+
public void downcastAndPolymorphism() {
9090
Grandparent child = new Child();
9191
Parent parent = (Child) child;
9292
// Think about the result. Did you expect that? Why?

0 commit comments

Comments
 (0)