Skip to content

Commit d0016be

Browse files
author
sinshutu
committed
gitlec2
1 parent 4ddbe88 commit d0016be

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

gitlec2/Main.java

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package gitlec2;
2+
3+
public class Main {
4+
5+
public static void main(String[] args) {
6+
Profile suzuki = new SuzukiProfile("naoto");
7+
suzuki.hello();
8+
}
9+
10+
}

gitlec2/Profile.java

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package gitlec2;
2+
3+
public abstract class Profile {
4+
private String name;
5+
6+
public Profile(String name) {
7+
this.name = name;
8+
}
9+
10+
public String getName() {
11+
return this.name;
12+
}
13+
14+
public void hello() {
15+
System.out.println("================================");
16+
System.out.println(getName() + "‚Ĺ‚·B\n" + profile());
17+
System.out.println("================================");
18+
19+
}
20+
21+
public abstract String profile();
22+
}

gitlec2/SuzukiProfile.java

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package gitlec2;
2+
3+
public class SuzukiProfile extends Profile {
4+
5+
public SuzukiProfile(String name) {
6+
super(name);
7+
}
8+
9+
@Override
10+
public String profile() {
11+
return "私の趣味は××××です。";
12+
}
13+
}

0 commit comments

Comments
 (0)