20172325 2017-2018-2 "Java Programming" Nineth Week study Summary
Summary of learning contents of textbook
1. Learn the basic concepts of anomalies;
2. Distinguishing between exceptions and errors:
- An exception is an object that defines an abnormal condition or error that is thrown by the program or run-time environment and can be captured and processed as needed. The error is similar to an exception, but the error represents an unrecoverable problem and must be captured for processing.
- An exception does represent an error, but an exception represents an unexpected situation, a situation that does not occur under normal conditions, and exception handling provides an effective way to handle exceptions.
3. Three basic methods for handling exceptions:
- Do not handle exceptions at all
- Handling exceptions when an exception occurs
- To handle exceptions centrally in a program location
4.try-catch statements
- No exception will continue after executing the statement block after the try statement, all the statements after the catch clause.
- If there is an exception, the control is immediately transferred to the corresponding catch clause to handle the exception.
5.finally statements
- A Try-catch statement can have an optional finally clause that defines a piece of code that executes regardless of whether an exception occurs.
- If there is a finally clause, it must be followed by all catch clauses.
- A try statement block can have no catch clause, but you can still use the finally clause.
Recursive
1. Recursive thinking: Recursion is a way to call their own programming technology, the key to mastering recursive programming is to consider the problem of recursive thinking;
2. The case of infinite recursion is similar to an infinite loop;
3. Direct recursion and indirect recursion:
- Method calls its own recursion, called direct recursion;
- If a method calls another method, which eventually results in calling itself again, it is called indirect recursion.
4. The classic application of recursion is the maze travel and Hanoi tower problem;
Problems in teaching materials learning and the solving process
- Question 1: After learning the concept and solution of the anomaly, I think there is a difference between the exception and the error, why the error cannot be handled in a way that solves the exception.
- Question 1 Solution: the study questions of the textbook has learned the difference between errors and anomalies:
Exception: An object that defines an informal situation or error that is thrown by a program or run-time environment and can be captured and processed as needed.
Error: The error is similar to an exception, but the error represents an unrecoverable problem and must be captured for processing.
But here I still don't know why I couldn't do it the same way, so I looked for the information, realized they were similar but not exactly the same, and the main differences were at the wrong level at run time, compared to the "wrong" level.
Problems in code debugging and the resolution process
- Question 1:
- Issue 1 Solution: XXXXXX
- Question 2:xxxxxx
- Issue 2 Solution: XXXXXX
- ...
Code Hosting last week exam error summary
Analysis: The problem is mainly due to the understanding of the concept is not clear. Overloading simply provides an alternative method for methods with different parameter lists. Overrides provide polymorphism because the appropriate method is called based on the object that is currently being referenced. Embedding is the closure of classes in a class. Abstraction is independent of polymorphism. Encapsulation is implemented by using visibility modifiers (public, private, protected).
Upcasting is completely secure, and it is the product of a single inheritance structure supported by Java. In contrast, downcasting must be explicitly done by the programmer. Java is cast only in one direction. The rules for upcasting and downcasting do not depend on the visibility modifiers in use.
Although inheritance and interfaces support polymorphism, this is done only with late binding. However, overloading is a form (method) name for polymorphism, multiple principals, so polymorphism is used whenever the program uses overloading.
Pair and peer review templates:
Other (sentiment, thinking, etc., optional)
- Always feel that the teacher should first lecture, we further study, after all, the teacher should first spread knowledge, now the model is very comfortable, in the learning process encountered a lot less problems, there are many things to see the know, do not have to find a professional solution as before, but also to find a person do not know the answer to the wrong.
- The first one months every night to practice cheerleading, and the class of students less than a lot of study time, now finally end, must step up the pace, but also the footsteps of teachers and classmates.
Learning progress Bar
|
lines of code (new/cumulative) |
Blog Volume (Add/accumulate) |
Learning Time (new/cumulative) |
Important Growth |
Goal |
5000 rows |
30 Articles |
400 hours |
|
First week |
129/129 |
1/1 |
20/20 |
|
Second week |
359/488 |
1/2 |
18/38 |
|
Third week |
521/1009 |
2/4 |
22/60 |
|
Week Four |
1057/2066 |
1/5 |
30/90 |
|
Week Five |
636/2702 |
1/6 |
30/120 |
|
Week Six |
489/3191 |
1/7 |
28/158 |
|
Seventh Week |
831/4022 |
1/8 |
41/199 |
|
Eighth Week |
382/4404 |
3/11 |
16/215 |
|
Nineth Week |
1301/5705 |
2/13 |
28/243 |
|
Resources
20172325 2017-2018-2 Java programming Nineth Week of study summary