📄 booktitleservice.java
字号:
// Fig. 6.2: BookTitleService.java
// Class BookTitleService provides the Book Title Web
// service, which returns a title of a book associated with an
// ISBN number.
package com.deitel.jws1.soap.services;
import java.util.*;
public class BookTitleService {
// Map contains ISBN/Book-Title pairs
Map books;
// constructor to initialize books HashMap
public BookTitleService()
{
books = new HashMap();
// store ISBN/Book-Title pairs in HashMap
books.put( "0130895601",
"Advanced Java 2 Platform How to Program" );
books.put( "0130895717",
"C++ How to Program, Third edition" );
books.put( "0130293636",
"Visual Basic. NET How to Program" );
books.put( "0130284173", "XML How to Program" );
books.put( "0130923613", "Python How to Program" );
} // end constructor
// service to obtain book title associated with ISBN number
public String getBookTitle( String ISBN )
{
return ( String ) books.get( ISBN );
}
} // end class BookTitleService
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -