File tree 7 files changed +100
-0
lines changed
src/com/selbylei/dm/strategy
7 files changed +100
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .selbylei .dm .strategy ;
2
+
3
+ /**
4
+ * Created by selbylei on 17/3/11.
5
+ */
6
+ public abstract class Duck {
7
+
8
+ public Duck (){
9
+
10
+ }
11
+
12
+ public void Quack (){
13
+ System .out .println ("gaga~~" );
14
+ }
15
+
16
+ public abstract void display ();
17
+
18
+ public void swim (){
19
+ System .out .println ("~~im swim~~" );
20
+ }
21
+
22
+
23
+ public void fly (){
24
+ System .out .println (fly );
25
+ }
26
+ }
Original file line number Diff line number Diff line change
1
+ package com .selbylei .dm .strategy ;
2
+
3
+ /**
4
+ * Created by selbylei on 17/3/11.
5
+ */
6
+ public class GreenHeadDuck extends Duck {
7
+
8
+ @ Override
9
+ public void display () {
10
+ System .out .println ("**GreenHeadDuck**" );
11
+ }
12
+
13
+
14
+ }
Original file line number Diff line number Diff line change
1
+ package com .selbylei .dm .strategy ;
2
+
3
+ /**
4
+ * Created by selbylei on 17/3/11.
5
+ */
6
+ public class Main {
7
+
8
+ public static void main (String [] args ) {
9
+ ReadHeadDuck readHeadDuck = new ReadHeadDuck ();
10
+ GreenHeadDuck greenHeadDuck = new GreenHeadDuck ();
11
+
12
+ greenHeadDuck .display ();
13
+ greenHeadDuck .Quack ();
14
+ greenHeadDuck .swim ();
15
+
16
+ readHeadDuck .display ();
17
+ readHeadDuck .Quack ();
18
+ readHeadDuck .swim ();
19
+
20
+ }
21
+ }
Original file line number Diff line number Diff line change
1
+ package com .selbylei .dm .strategy ;
2
+
3
+ /**
4
+ * Created by selbylei on 17/3/11.
5
+ */
6
+ public class ReadHeadDuck extends Duck {
7
+
8
+ @ Override
9
+ public void display () {
10
+ System .out .println ("**ReadHeadDuck**" );
11
+ }
12
+
13
+
14
+ }
Original file line number Diff line number Diff line change
1
+ 1.模拟鸭子项目
2
+ 2.项目新需求
3
+ 3.用OOP开发项目
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <web-app xmlns =" http://xmlns.jcp.org/xml/ns/javaee"
3
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi : schemaLocation =" http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
5
+ version =" 3.1" >
6
+ </web-app >
Original file line number Diff line number Diff line change
1
+ <%--
2
+ Created by IntelliJ IDEA.
3
+ User: selbylei
4
+ Date: 17/3/11
5
+ Time: 21:56
6
+ To change this template use File | Settings | File Templates.
7
+ --%>
8
+ <%@ page contentType =" text/html;charset=UTF-8" language =" java" %>
9
+ <html >
10
+ <head >
11
+ <title ></title >
12
+ </head >
13
+ <body >
14
+
15
+ </body >
16
+ </html >
You can’t perform that action at this time.
0 commit comments