/Users/lyon/j4p/src/bookExamples/ch03Ops/ConditionalDemo.java
|
1 package bookExamples.ch03Ops;
2
3 public class ConditionalDemo {
4 public static void main(String args[]) {
5 ConditionalDemo cd
6 = new ConditionalDemo();
7 cd.run(10, 20);
8 cd.run(20, 10);
9 }
10
11 public void run(int x, int y) {
12 System.out.println("x,y="
13 + x + ',' + y
14 + " max=" + max(x, y)
15 + " min=" + min(x, y));
16 }
17
18 public int min(int x, int y) {
19 return x < y ? x : y;
20 }
21
22 public int max(int x, int y) {
23 return x > y ? x : y;
24 }
25 }