Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 094b9e6

Browse files
Challenge 66
static method hiding, polymorphism.
1 parent 603c944 commit 094b9e6

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

‎src/main/java/challenge61_70/Challenge_61.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ public static void main( String[] args ) {
2727
mainMap.put(subMap3, "crazyMap3");
2828

2929
System.out.println(mainMap.size());
30-
System.out.println("mainMap.entrySet().size() = " + mainMap.entrySet().size());
30+
31+
32+
System.out.println("mainMap.get(subMap1) = " + mainMap.get(subMap1));
33+
System.out.println("mainMap.get(subMap3) = " + mainMap.get(subMap3));
34+
3135

3236
}
3337
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package challenge61_70;
2+
3+
public class Challenge_66 {
4+
public static void main( String[] args ) {
5+
Dracula dracula = new Hulu();
6+
System.out.println("dracula.name+dracula.getName() = " + dracula.name + dracula.getName());
7+
System.out.println("dracula.metamorphosis() = " + dracula.metamorphosis());
8+
}
9+
10+
static class Dracula {
11+
String name = "Dracula";
12+
double forceLevel=777;
13+
14+
public String getName() {return name;}
15+
static String metamorphosis(){return "vraag";}
16+
}
17+
18+
static class Hulu extends Dracula{
19+
String name = "Hulu";
20+
21+
static String metamorphosis(){return "aantwoord";}
22+
@Override
23+
public String getName() {return name;}
24+
}
25+
26+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /