?? mainclass.java
字號:
package problem_10;
//MainClass.java
import java.io.*;
public class MainClass {
public static void main(String[] args){
try{
//讀入書籍信息
System.out.print("Number of books = ");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Integer bookNum = new Integer(Integer.valueOf(br.readLine()));
Bag bookBag = new Bag(); //構造Bag類對象
//從指定文件讀取書籍信息并對信息進行處理
FileInputStream fis = new FileInputStream("D:\\BookList.txt");
br = new BufferedReader(new InputStreamReader(fis));
String tempAll = br.readLine();
String[] tempRespect = tempAll.split(";"); //拆分各書
for(int i = 0; i < bookNum.intValue(); i++){ //拆分各項并向書包中添加各書
String[] temp = tempRespect[i].split(",");
Double tempPrice = Double.valueOf(temp[4]);
bookBag.add(new Book(temp[0], temp[1], temp[2], temp[3], tempPrice.doubleValue()));
}
BookShelf bookShelf = new BookShelf(bookBag); //構造書架類
bookShelf.displayBookShelf(); //顯示書架
}
catch(IOException e){
System.out.println(e);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -