exercise16_13.java
来自「Introduction to java programming 一书中所有编程」· Java 代码 · 共 26 行
JAVA
26 行
import java.io.*;
public class Exercise16_13 {
public static void main(String[] args) {
int total = 0;
int count = 0;
try {
ObjectInputStream input = new ObjectInputStream(new BufferedInputStream(
new FileInputStream("Exercise16_13.dat")));
while (true) {
Loan loan = (Loan)(input.readObject());
total += loan.getLoanAmount();
count++;
}
}
catch (EOFException ex) {
System.out.println("Number of loan objects is " + count);
System.out.println("Total loan amount is " + total);
}
catch (Exception ex) {
ex.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?