KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SimpleFields


1 public class SimpleFields {
2
3     Point p1 = new Point();
4     Point p2 = new Point();
5
6     public static void main(String JavaDoc [] args){
7         SimpleFields sf = new SimpleFields();
8         sf.run();
9     }
10     
11     public void run(){
12         int i = 3;
13
14         p1.x = 9;
15         p1.y = 8;
16
17         p2.x = i;
18         p2.y = 4;
19
20         if ((p1.x - p2.x) > (p1.y - p2.y)){
21            p1.x = p1.y;
22         }
23     }
24
25     public void test(Point p){
26         if (p.x > 3){
27            p.y = 3;
28         }
29     }
30 }
31 class Point {
32
33     public int x;
34     public int y;
35 }
36
37
Popular Tags