The fifth week of Java Programming Study summary 20165218 2017-2018-2 Textbook Study Contents 7th Chapter Inner class and exception class inner class
- Defining another class in a class, outer-nested and inner classes
- Inner classes can use member variables and methods in an outer-nested class
- Inner classes cannot declare class variables and class methods
- For use only with outer-nested classes
Exception class
Try-catch statements
try{可能发生异常的语句}catch(ExceptionSubClass1 e){...}catch(ExceptionSubClass2 e){...}
Once the try section throws an exception object, the try part immediately ends and goes to the appropriate catch section, or you can throw
intentionally throw an exception.
Assertion
//格式一assert booleanException;//如果booleanException为true,继续执行程序;否则立刻结束//格式二assert booleanException:messageException;//如果booleanException为true,继续执行程序;否则输出messageException,结束执行
Problems in code debugging and the resolution process
Question 1: The text of the No. 286 page of the textbook starts running as follows
Issue 1 Solution: Change line 12th File f = new File("F:\\JAVAcode\\Ch10\\src","Example10_4.java");
, which is the path to my own code, to run normally
Code Hosting
Last week's summary of the wrong quiz
Textbook Page 77
If there are class variables in the class, when multiple different objects are created with the new operator, the class variable assigned to these objects occupies the same memory, and changing the class variable of one object affects the class variable of the other object, that is, the object shares the class variable .
Resources
The fifth week of Java Programming Study summary 20165218 2017-2018-2