20172306 Summary of the Nineth week of Java programming and data structure

Source: Internet
Author: User
Tags stack trace

20172306 "Java program design" The Nineth Week study summary textbook Learning content Summary

The 11th chapter:

    1. The Try-catch statement. There is also a finally statement. A try is something that catches an exception and makes certain operations through some exceptions. Finally is the statement that will be made whether or not an exception occurs. There can be no catch statement.
    2. The delivery of the exception. I think that the exception is caused by other methods, and the exception is passed on to that method. The examples in the book can be very well expressed.
    3. IO exception. The contents of the book are mainly written around the exception. In the blue ink cloud, the teacher wrote more detailed information about IO. For example, create files, write files, read files, and so on.

The 12th chapter:

    1. Recursion and looping are similar, but there are still different. For dead loops and dead recursion, the dead loop will continue to circulate, and the dead recursion will overflow. Because space is limited.
    2. Through the maze of travel and the model of the Hanoi tower problem, I personally learned that consideration of the problem needs to be detailed. I think it is more important to understand how this is done, and how the code is written.
Problems in teaching materials learning and the solving process
    • Question 1: What is a method call stack trace?
    • Problem 1 Solution: I checked the internet.

    • Question 2: For a line of code in eg11.2: district = Integer.parseint (code.substring (3,7)), Middle (3,7) do not understand how much?
    • Problem 2 Solution: use idea to see, substring (begineindex,endindex); I asked my classmates again, I know this should be index 3,4,5,6. Not 7.

    • Question 3:
    • Problem 3 Solution: At first it didn't understand the meaning of start,end,temp. Later asked the classmate, plus their own understanding. Know that this method is, in our usual time, through the constant invocation of another pillar to achieve from the large to the small arrangement of such a process.

Problems in code debugging and the resolution process
    • Question 1: In the course of the experiment, there is such a problem, do not know why

    • Problem 1 Solution: Originally in idea, I applied Chinese, then I should, so I can apply Chinese.

    • Question 2: When doing PP12.1, the first thing I wanted was to change the tester of the fifth chapter according to the style of the Maze Travel code in the book. , but the result is wrong. Even with the example Abracadabra in the book, the result is the IS and actually should not be

    • Problem 2 Solution: At first I was wondering if my condition was wrong. I made a slight adjustment and found that it was still wrong. Later I was thinking, this does not pass, can see try to Hanoi that model, later used another way to succeed.
    • Question 3: It took a long time to do PP12.9 exercises. At first I could not find the logic of it. Later thought could be in the form of arrays of rows and columns. I wrote this in my book and made up a recursive class. But there was this problem.

    • Problem 3 Solution: I checked the Internet, this means that the stack overflow, indicating that my expression is not optimized. So the changes were made.
    • Question 4: It's still a question of PP12.9. I can run, but the result is I changed it, but it became

    • Problem 4 Solution: Originally I was going to do it, then asked the classmate, just know how I should change, and then got the result of matching the conditions

Code Hosting

Last week's summary of the wrong quiz
  • a finally clause would execute
    A only if the try statement that precedes it does not throw an exception
    B only if The try statement that precedes it throws a exception that's caught
    C only if the try statement that precedes it thr oWS an exception that's not caught
    D only if the try statement that precedes it throws a exception, whether it is Cau Ght or not
    E in any circumstance the subject of choice E, this problem is my sloppy. Finally, it will be executed in any case.
  • The
  • the Scanner class provides an abstraction-input operations by Scanner class provides an abstraction for input operations
    A using try and catch Statem Ents to catch any ioexception instead of throwing the Exception elsewhere (capture any ioexception using try and catch statements instead of throwing exceptions elsewhere)
    B parsing input lines into individual tokens (resolves input lines to a single tick)
    C performing conversion operations from String to the APPROPR Iate type as specified in the Scanner message (conversion operation from string to the appropriate type specified in the scan messages)
    D inputting from the standard input stream if CR Eate is called using system.in if the call is created using the system then input from the standard input stream. )
    E All of the above select E
  • the term "exception propagation" means
    A exception are caught by the first catch clause
    B-Exception not Cau Ght by the first catch clause was caught by an outer (enclosing) Catch clause (the exception caught by a catch clause is not captured by an external (closed) catch clause)
    C EX Ceptions is caught, sequentially, by catch clauses in the current try block
    D exceptions always is caught by the Oute Rmost Try block (exception is always captured by outermost try blocks)
    E None of the above selected E
  • A method that uses the Scanner class to obtain input does not require either catching or throwing an ioexception. This is because
    A the Scanner class does not call upon any classes that throw checked exceptions
    B the Scanner class ' methods call input methods in try statements and catch ioexceptions so that they is handled directly In the Scanner class
    C the Scanner class uses Joptionpane dialog boxes instead of java.io classes so this it does not has to deal with IOEXCEP tions
    D the Scanner class overrides the class IOException making it an unchecked exception
    E none of the above, methods do require handling IOException even if thrown by a method in a Scanner class select B
  • The following defines a new Exception called Anewexception.
    Public Exception Anewexception
    {
    Public anewexception (String message)
    {
    Super (message);
    }
    }
    A true
    b False to select B it should be defined as a class, not a exception.
  • If an exception arises in a catch statement, and the exception are of the type caught by the catch statement, then the CATC H statement catches the same exception. For instance, if the following catch statement first catches an arithmeticexception and, while executing, throws another A Rithmeticexception, it's able to catch the second arithmeticexception as well the first.
    catch (ArithmeticException ex) {...}
    A true
    b False to select B A exception causes the current statement to stop executing and control the transfer to the first capture (after the current statement) to catch the exception. Therefore, a catch statement does not catch an exception that is thrown from within itself, although a catch statement can be nested within its internal attach attempt and capture statement.
  • The difference between the throw reserved word and the throws reserved word is that throw is used within a method body, WH Ile throws is used within a method header.
    A true
    B false to select a, which is mainly a distinction between throws and throw.
Pair and peer review templates:
    • Blogs that are worth learning or questions:
      • Xxx
      • Xxx
      • ...
    • Something worth learning or doing in your code:
      • Xxx
      • Xxx
      • ...
    • Based on the scoring criteria, I scored this blog: xx points. The score is as follows: XXX

    • Reference example

reviewed the classmates blog and code
    • This week's study of the knot
      • 20172325
        • The contents of chapters 11th and 12th are studied together.
Other
这两章是在老师讲了之后我才去看的。基本是看得懂的。但是老师说对于IO异常这个方面,更需要了解的是如何利用流进行读写文件等。这个方面我觉得我还不是很会,所以之后还会继续学习这个。而十二章,我觉得对于我来说,重点就是要了解它每一步的操作,因为我觉得书中的递归的代码写的十分的缜密,这个方面我也不擅长,就在编写后面的题时就可能想少东西,导致结果有问题。还需要学习。
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 193/200 1/1 20/20
Second week 247/440 1/1 22/42
Third week 445/895 2/2 20/62
Week Four 885/1780 1/1 43/105
Week Five 775/2555 1/1 55/160
Week Six 1171/3726 1/1 38/198
Seventh Week 596/4322 1/1 60/258
Eighth Week 569/4891 2/2 55/313
Nineth Week 1890/6781 1/1 66/379
Resources
    • Java Learning Notes (8th Edition)

    • Java Learning Note (8th Edition) Learning Guide

20172306 Java programming and data structure Nineth Week of study summary

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.