20165301 2017-2018-2 "Java program design" Fifth week study summary textbook Learning content Summary seventh: Inner class and Exception class
- Inner class
- Defining another class in one class
- Non-intrinsic class is not a static class
- Anonymous class
- A subclass removes the class-declaration-body
- Create an object with a subclass of bank (anonymous class)
new Bank(){ 匿名类的类体 }
- Anonymous classes related to interfaces
new Computable(){ 实现接口的匿名类的类体 }
- Exception class
- The exception object can call the following method to get or output information about the exception
public String getMessage(); public void printStackTrace(); public String toString();
- Try-catch statements
- If a return statement is executed in the Try-catch statement, then the finally child statement is still executed
- The program exit code is executed in the Try-catch statement, that is, execution of System.exit (0), and the finally child statement is not executed
- Assertion
Tenth chapter: input, Output stream
- File class
- Create a method for constructing a file object where filename is the name of the document, DirectoryPath is the path to the file, and Dir is a directory:
File(String filename);File(String directoryPath,String filename);File(File dir,String filename);
- Buffered streams
- Output stream: The Read and write methods of the character input stream and output stream use a character array to read the data
- Use scanner to parse a file, create a dialog box with JFileChooser
Code Hosting
(run result of statistics.sh script)
Learning progress Bar
|
lines of code (new/cumulative) |
Blog Volume (Add/accumulate) |
Learning Time (new/cumulative) |
Important Growth |
target |
5000 Line |
30 |
400 hours |
|
first week |
11/11 |
1/1 |
4/4 |
|
second week |
286/297 |
2/3 |
6/10 |
|
third week |
722/1004 |
1/4 |
10/20 |
|
fourth week |
421/1425 |
1/5 |
10/30 |
|
fifth week |
829/2283 |
1/6 |
10/40 |
|
20165301 2017-2018-2 Java programming Fifth week of study summary