File tree 2 files changed +35
-1
lines changed
2 files changed +35
-1
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
public class simonguzman {
2
2
public static void main (String [] args ) {
3
3
exampleNoIsp ();
4
+ exampleIsp ();
4
5
}
5
6
6
7
/******************************** Ejercicio adicional con isp ********************************/
7
8
8
9
/******************************** Ejercicio adicional sin isp ********************************/
9
10
10
11
/******************************** Ejemplo con isp ********************************/
12
+ static void exampleIsp (){
13
+ Workable robotIsp = new RobotIsp ();
14
+ robotIsp .work ();
11
15
16
+ Employee employee = new Employee ();
17
+ employee .work ();
18
+ employee .eat ();
19
+ }
20
+
21
+ static interface Workable {
22
+ void work ();
23
+ }
24
+
25
+ static interface Eatable {
26
+ void eat ();
27
+ }
28
+
29
+ static class RobotIsp implements Workable {
30
+ @ Override
31
+ public void work () {
32
+ System .out .println ("El robot está trabajando." );
33
+ }
34
+ }
35
+
36
+ static class Employee implements Workable , Eatable {
37
+ @ Override
38
+ public void work () {
39
+ System .out .println ("El empleado está trabajando." );
40
+ }
41
+
42
+ @ Override
43
+ public void eat () {
44
+ System .out .println ("El empleado está comiendo." );
45
+ }
46
+ }
12
47
/******************************** Ejemplo sin isp ********************************/
13
48
static void exampleNoIsp (){
14
49
Worker robot = new Robot ();
You can’t perform that action at this time.
0 commit comments