KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > CarImpl


1 import org.ozoneDB.OzoneObject;
2 import java.util.*;
3
4 public class CarImpl extends OzoneObject implements Car {
5     
6     /**
7     Set version of the serialized data to make it compatible with
8     new class versions.
9     */

10     final static long serialVersionUID = 1L;
11     
12     private String JavaDoc _name;
13     
14     private int _yearOfConst;
15     
16     public CarImpl() {
17         _name = new String JavaDoc( "" );
18         _yearOfConst = 0;
19     }
20     
21     public String JavaDoc name() {
22         return _name;
23     }
24     
25     public void setName( String JavaDoc name ) {
26         _name = name;
27     }
28     
29     public void setYearOfConst( int year ) {
30         _yearOfConst = year;
31     }
32     
33     public int age() {
34         Calendar cal = Calendar.getInstance();
35         return cal.get (Calendar.YEAR) - _yearOfConst;
36     }
37 }
38
Popular Tags