KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > Book


1 /*
2  * Copyright 2003-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 /**
18  * See Main.java.
19  */

20 public class Book implements Item {
21
22   private String JavaDoc isbn;
23   private String JavaDoc title;
24   private String JavaDoc author;
25   private String JavaDoc desc;
26
27   public Book(String JavaDoc isbn) {
28       this.isbn = isbn;
29   }
30   
31   public void setTitle(String JavaDoc title) {
32       this.title = title;
33   }
34   
35   public void setAuthor(String JavaDoc author) {
36       this.author = author;
37   }
38   
39   public void setDesc(String JavaDoc desc) {
40       this.desc = desc;
41   }
42   
43   public void print() {
44       System.out.println("Book:");
45       System.out.println(" isbn=" + isbn);
46       System.out.println(" title=" + title);
47       System.out.println(" author=" + author);
48       System.out.println(" desc=" + desc);
49   }
50 }
51
Popular Tags