Professional Documents
Culture Documents
CSCI 201
Principles of Software Development
ALU
Registers
Cache
CPU
Hard Drive External Storage
USB Drives
CD/DVD
10x Main Memory Network Drive
Tape Backup
External Hard Drive
100x
1,000x
10,000x-100,000x Note: Times are estimated relative values
compared to accessing data from a register
3/9
Actual Computer Diagram
4/9
File Input
1 import java.io.BufferedReader; 22 if (br != null) {
2 import java.io.FileReader; 23 try {
3 import java.io.FileNotFoundException; 24 br.close();
4 import java.io.IOException; 25 } catch (IOException ioe) {
5 public class Test { 26 System.out.print(ioe.getMessage());
6 public static void main(String [] args) { 27 }
7 FileReader fr; 28 }
8 BufferedReader br; 29 if (fr != null) {
9 try { 30 try {
10 fr = new FileReader("Test.java"); 31 fr.close();
11 br = new BufferedReader(fr); 32 } catch (IOException ioe) {
12 String line = br.readLine(); 33 System.out.print(ioe.getMessage());
13 while (line != null) { 34 }
14 System.out.println(line); 35 }
15 line = br.readLine(); 36 } // ends finally
16 } 37 } // ends main
17 } catch (FileNotFoundException fnfe) { 38 } // ends Test
18 System.out.println(fnfe.getMessage());
19 } catch (IOException ioe) {
20 System.out.println(ioe.getMessage());
21 } finally {