2017-2018-2 "Program Design and Data Structure" Week 7 Learning Summary

20172312 2017-2018-2 "Program Design and Data Structure" Week 7 Learning Summary

Textbook learning content summary

Chapter 9 The difficulty is not as big as I imagined, isn't it just an extend = =

Of course, some emmm small knowledge points, well, it is still difficult.

Summarize:

1. Inheritance is the process of deriving a new class from an existing class.

2. One of the purposes of inheritance is to reuse existing software.

3. In inheritance, the subclass "is" the parent class, but the parent class "is not" the subclass.

4. All java classes are directly or indirectly generated by the Object class.

5. The concept of inheritance can be applied to interfaces.

6. The abstract class cannot be instantiated, the subclass will define methods based on the abstract class.

7.final can be used to restrict inheritance.

Problems and Solving Processes in Teaching Materials Learning

  • Question 1: Interface hierarchy in 9.3.3.
  • Solution to problem 1: Don't say it, this kind of problem without examples is the most difficult to understand. Forget it, it's not important. I'll just be honest with Baidu. https://www.cnblogs.com/fuhengheng/p/7998141.html I'm sorry, I only found this, but I still don't understand it. Well, wait for the teacher to explain.

Problems and solutions in code debugging

  • Question 1: At the beginning of the experiment, I used various methods for comparison, but there were always various errors that I couldn't understand anyway. After consulting Yu Xinyue, she also encountered such a problem. Well solved.
  • Solution to problem 1: Because the result of getRealPart is defined as a string variable in the complex, it can be solved by converting it into a string. Of course, you can also change the method in the complex to double... to double... to double... double... IDEA, you are targeting me, and you will lose this baby. So why? !
  • Question 2: To be reasonable, the code this week is quite simple. The only one that is a little longer is the coin in pp9-1, and he is still an example in Chapter 5. 

 

 

code hosting

 

 

 

Summary of last week's exam mistakes

  • 1.Q. The "off-by-one" error related to arrays is because. the first array index is 0 and programmers may start at index 1, or may use a loop that goes one index too far
  • A. The array is initialized to = new type[x], where x is the size of the array. However, the legal indices for arrays are 0 to X-1, so programmers often go one by one as the programmer will write code to try to access indices 1 to X.
  • 2.Q. Suppose BankAccount is a predefined class and the declaration BankAccount[ ] firstEmpireBank has been executed. Then, the following instructions reserve memory space firstEmpireBank = new BankAccount[1000];
  • A.The declaration BankAccount[ ] firstEmpireBank; reserves memory space for firstEmpireBank, which itself is a reference variable that points to the BankAccount[ ] object.  The statement firstEmpireBank = new BankAccount[1000]; instantiates the BankAccount[ ] object to be 1000 BankAccount objects.  This means that firstEmpireBank[0] and firstEmpireBank[1] and firstEmpireBank[999] are all now legal references, each of which is a reference variable since each references a BankAccount object.  So, the statement reserves memory space for 1000 reference variables.  Note that none of the 1000 BankAccount objects are yet instantiated, so no memory has been set aside yet for any of the actual BankAccount objects.
  • 3.Q.If a and b are both int arrays, then a = b; will   创建别名
  • A. "=" is the assignment operator. If the two variables are primitives, the left-hand variable gets a copy of the right-hand variable (if A and B are int values, and B=5, then A will become 5). However, since A and B are arrays, reference variable A is set to reference variable B, causing both A and B to reference the same array in memory, or they are now aliases to each other.
  • 4.Q. Arrays have a built-in ToString method, which inserts all elements in the array as a string and inserts "\n" between each element. false
  • A. Arrays are objects, so they are inherited from the object class. The object class has a ToStand method. However, the toStand method of an object does not return the value stored in the object, but the value of the referenced variable. Therefore, ToStin used on an array will not return the value stored in the array, but a nonsense charset.
  • 5.Q. A java method mainly takes parameters (string[] variables) so that the user can run the program and supply "command line parameters". However, since the parameters are arrays of strings, the user does not have to supply any parameters. true
  • A. In cases where the programmer wishes to allow the user to provide command-line arguments, the main method requires arguments. Any java command entered into the command line will accept command line arguments. If it is several words separated by spaces, each word is stored as a separate string array element. For example, "java foo.class hello" would change "hi" to [0] and a program for "there" might use variable [1].
  • 6.Q. When instantiated, the size of the array is fixed, but when new elements are added, the array list can change size dynamically. true
  • A. The disadvantage of an array is its fixed size. Once instantiated, it is fixed in size, so if the program tries to add more elements than the size of the array will cause an exception to be thrown. ARAYLIST is a class that takes arrays and automatically creates larger arrays, copying the old array into the new array so it can be larger as needed. While this will solve the problem of throwing exceptions, it does lead to poor performance because you have to copy from one array to another every time you increase the size of the array.
  • 7.Q. A rough array is a multidimensional array whose initial indices are not all zero-based. false
  • A. A rough array is a multidimensional array whose lengths are not all equal. The initial indices of all arrays in java must start from zero.

 

  • Pairing and mutual evaluation

Grading

  1. Correct use of Markdown syntax (plus 1 point):
    • No points for not using Markdown
    • No extra points for grammatical errors (links can't be opened, tables are incorrect, lists are incorrect...)
    • No points for messy typography
  2. The elements in the template are complete (plus 1 point)
    • No points for lack of "Problems and Solving Processes in Textbook Learning"
    • No bonus points for missing "Issues in Code Debugging and Resolution Processes"
    • No bonus points for code hosting that cannot be opened
    • No points will be added for those that cannot be opened without "pairing and mutual evaluation"
    • No extra points for missing "summary of last week's exam mistakes"
    • Missing "progress bar" can not add points
    • No extra points for missing "references"
  3. Problems and solving process in teaching material learning, one point is added for each problem

  4. Problems and solutions in code debugging, plus 1 point for each problem

  5. This week's valid code exceeds 300 branches (plus 2 points)
    • No extra points for submissions less than 20 times a week
  6. Other bonus points:
    • 1 point for blogging before Friday
    • Feelings, experience is not fake plus 1 point
    • Nice typography plus a point
    • Add 1 point for recording the learning time and improvement in the progress bar
    • 1 point for writing new code by hand
    • After-class multiple-choice questions with verification plus 1 point
    • 1 point for code Commit Message specification
    • Add 1 point for in-depth study of wrong questions
    • Serious comments, plus 1 point for pointing out problems in the blog and code
    • 1 point for true and credible paired learning
  7. Deductions:
    • 0 points for plagiarism
    • Code cheating will be deducted to 0 points
    • 0 points for late work

Review Template:

 

  • Worth learning or questions from the blog:
    • There are many pictures. When I make mistakes, I always forget to take screenshots. At the end, I use typing to indicate the wrong questions.
    • The problem is the translation, but the quality of the translation is not good
  • Worth learning or problems in the code:
    • pp8.5 input end stop is a very novel idea
  • Based on the scoring criteria, I rate this blog: 11 points.

Reviewed classmates blog and code

  • Pair study this week
    • 20172318
    • 20172315
    • Pair learning content
      • pp9.1

      • Inheritance, creation of subclasses

learning progress bar

  Lines of code (added/accumulated) Blog volume (new/cumulative) Study time (added/accumulated) important growth
Target 5000 lines 30 articles 400 hours  
fifth week 347/2019 1/10 26/153  
Week 6 728/2747  1/11  31/184   

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324649645&siteId=291194637