20,182,327 2019-2020-1 "Object-oriented programming and data structures," the fourth week of learning summary

20,182,327 2019-2020-1 "Object-oriented programming and data structures," the fourth week of learning summary

Learning content summary

1. Further information about the classes and objects (classes, attributes, operations). Simple point to understand is that a good number of objects that make up a class.
2. Analysis of writing a class for. (Examples of data encapsulation, visibility modifiers, and access modifier).
3. The relationship between structure and for Class Description Class: UML class diagram.
The method of analysis. (Return statements, parameters, local data, constructor).
The four processes of software development.
6. definite classes and objects (class named object in general is a noun, a verb like behavior generally.)
7. static variables and static methods. (Local variables within the method can not be declared as static, static variables can be shared by all instances of the class; static methods can be invoked through the class name does not have to instantiate the object class.)
8. The relationship between class (this chapter is mainly about the dependence relationship and aggregation relationship.)
9. often this statement is used in the constructor.
10. constants and abstract methods comprising an interface (Comparable interface and the Iterator interface).

Issue ## textbook learning and settlement process

  • Question 1: What is the scope of the variable?
  • ANSWER: The reference range variable is the variable that can be referenced in the program area. Declared in the class-level instance variables can be referenced by any of the methods of the class. In one particular method declaration of local variables (formal parameters including), the method can only be referenced.

  • Question 2: return statement how to use? Why can not return once more actual parameters?
  • ANSWER: The return value type methods must be consistent with the method statement returns the value specified in the header type. When the method does not return any value, as a void return type. A return statement consists of the reserved word return and subsequent optional expressions. Return statement is executed, control returns immediately to the calling method, and returns the return value of the expression defining equation.

  • Question 3: What is the difference between static variables and static methods?
  • Answer:
    Static variables there are two cases:
    static variables are the basic data type, in this case outside the class do not have to create an instance of this class can be used as
    a static variable is a reference. This situation is more special, the main problem is due to the static variable is a reference to an object, the object must be initialized after the reference to point to it.
    So if we want a reference defined as static, it is necessary to initialize the object at the time of its definition.
    Static method: class variables and different methods (static methods and instance methods) only one in memory, no matter how many instances of the class, share a method.
    Different static methods and instance methods are:
    Static methods can be used directly, and examples of the method must be called by the object after the class is instantiated.

Code debugging and problem solving in the process

  • Question 1: Using IDEA output Chinese garbled.

  • Question 1 solution: the lower right corner you can select normal output GBK Chinese.

  • Question 2: achieve comparable interface
  • Problem 2 Solution:
    the original idea for the use of the double type format into a string, then converted again into a double. But the fact is, the core of this problem lies implement an interface, review books, combined with the Internet. This can be solved.

Code hosting

(Run results screenshot statistics.sh script)

Last week exam wrong question summary

  • Wrong question 1:? Inheritance through an extended ( derived) class supports which of the following concepts ( inheritance by extending the (derived) Which of the following classes to support the concept of a?)
    A.interfaces
    B.modulary
    C.information Hiding
    D.code reuse (code reuse)
    E.correctness
    error Analysis: inherit a class and by extending it, the new class inherits the need to re-implement methods or any instance data, thereby saving the work for the programmer. Therefore, the ability to reuse code reuse code, others to meet your needs by expanding it. By inheriting the parent class can greatly reduce code duplication, for his selection interface class, he said he was very fans, do not know how to choose the interface.

  • The wrong question 2:? Which of the following is true regarding Java classes ( for Java classes, Which of the following is true?)
    A.All classes the MUST have have have have 1 parent But May of the any Number The Children (derived or Extended) classes (all classes must have a parent, but may have any number of subclasses (extended or derived) class.)
    B.All classes mUST have have child. 1 (extended or derived) class but On may have have the any number of parent classes
    C MUST have have parent classes. 1 .all class A and have have On May SINGLE Child (Extended or derived) class
    D.All CAN classes have have the any Number (More or 0) of the any parent classes and Number of Children (Extended or derived) classes
    e.all classes can have either 0 or 1 parent class and any number of children (derived or extended) classes
    Error parsing: Java support inheritance, but it does not support multiple inheritance, so Java class can have any number of child elements, but only one parent. In addition, because all Java classes inherit directly or indirectly from the object class, all Java classes have only one parent. In doing this problem, taking into account the ultimate parent --Object class, because it has no parent, so I chose the E option is, however, the teacher said, could Object class see themselves as problem your own parent, I also he said he was helpless. This sub distressed ......

  • Wrong question 3: A variable declared to be of one class can later reference an extended class of that class This variable is known as ( variables declared in a class can refer to later extend this class this variable is called... )
    A.protected
    B.derivable
    C.cloneable
    D.polymorphic (polymorphism)
    E.none of The above, A variable declared to One class of CAN BE Never Reference OTHER the any type of class, the even class AN Extended
    error Analysis: The term multi- state means that the variable can take many forms. In general, Java is strongly defined as a variable, is declared as a type once, will never change to another type. Exceptionally, polymorphic variable may be any type of a derived class (although not at the same time, a variable can be converted from one type to another type). Polymorphic question, after reading the tenth chapter, see the answer to this question, the object declaration by the parent class, you can reference subclass inherits the parent class, this flexible operation is achieved through inheritance polymorphism.

  • Wrong question 4: In order to determine the type that a polymorphic variable refers to, the decision is made ( in order to determine the type of multi-state variable referred to, made the decision.)
    A.by at The Programmer IS AT Program at The Time at The written
    AT the compile Compiler time at the B.by
    C.by at the Operating System the when loaded at the iS INTO Program Memory
    D.by at the Java rUN rUN AT time-time environment (via Java runtime environment run-time.)
    E.by the User at the AT rUN time
  • Error Analysis: polymorphic variable can contain many different types, but before the program is executed, it does not know which type. When referring to variables, you must make a decision. This decision was made according to the latest run-time environment variables and distribution made. This question is related to multi-state problem, so after reading the tenth chapter, is the problem of dynamic binding, early binding efficiency than the low, but dynamic binding, it reflects the multi-state flexibility.

  • Wrong question 5: Using the reserved word, super , one can ( use a reserved word super, can)
    A.access A parent class'constructor (S)
    B.access A parent instance class'methods and Data
    C.access class A Child ' constructor (S)
    D.access instance a and Child class'methods data
    E.none of the above
    error analysis: reserved words super provides a mechanism for data access methods, and examples of the parent class (whether or not they hidden). Further, it is possible to use super access structure of the parent class. The correct answer is A and B combination options.

  • Wrong question 6: If you instantiate an Abstract class , the class or object you wind up with ( if you instantiate an abstract class, class or object will be)
    A.is AN Also the Abstract class
    B.is A Normal class
    C.is Interface AN
    D.is AN a Reference to Object
    E.can't not exist you cAN AN the instantiate the abstract class (does not exist can not instantiate an abstract class)
    error Analysis: You can only instantiate concrete classes rather than abstract classes. But you can extend abstract classes and interfaces.
    An abstract class can actually be instantiated, but he's not the way to create an instance of the way through the new object, but by reference to the parent class to point to instances of subclasses to achieve indirectly instantiated parent class (since subclasses to examples of the former, you will first instantiate a parent class so he creates an object of a subclass inherits an abstract class, but also put the parent class (abstract class) to instantiate) However: the interface can not be instantiated (interface not constructor).

  • The wrong question 7: all methods A derived class has access to all of the methods of the parent class, but only the protected or public instance data of the parent class ( derived class can access the parent class, but only to access a parent class protection or public instance data)
    A.true
    B.false
    error Analysis: as the method can also be declared private, so the derived class can not access any private methods. Thus, the derived class can access a protected and public methods and instance data in the parent class. I do not see access to all methods, so by the last part of the direct think.

  • Wrong question 8: If class AParentClass has a protected instance data x, and AChildClass is a derived class of AParentClass, then AChildClass can access x but can not redefine x to be a different type ( if the class AParentClass have a protected instance data. x, and AChildClass is AParentClass a derived class, then AChildClass access to x, but x can not be redefined to another type.)
    A.true
    B.false

  • The wrong questions 9
    Aside from Permitting Inheritance, at The visibility modifier protected IS Also Used to
    A. in permit at The Access to protected by the any class defined in Item at The Same, Package Penalty for
    B. Item in permit Access to protected by the any static at The class
    C. in permit at The Access to Item by the any parent class protected
    D. of Ensure that at the class a CAN not the throw NullPointerException
    E. Elements of the DEFINE AN abstract interface
    correct answer: a my answer: B
    Analysis: protected visibility modifier for a protected mode control access to the project. Access protection is limited to the current class (such as private project), the same package of the class or classes of such an extension.

  • Wrong title 10
    Which of IS AN at The following Example of Multiple Inheritance?
    A. A CAN BE A Mainframe Computer A PC or
    B. A PC CAN BE A Desktop or Laptop A
    C. A Laptop IS A both-A PC and Portable Device
    D. iS a Lightweight Portable Device a Device
    E. Macintosh and IBM PC are both-types of the PCs
    correct answer: C my answer: E
    Analysis: multiple inheritance means that a given class inherits more than one parent class. Of those, notebooks listed above inherits the properties from the PC and portable devices. A, B and E is a single answer to inherit example, a class in which there are at least two children (in A, mainframe computers have children and PC, B, PC have children desktop and notebook computers, E, PC have children Macintosh and IBM PC). The answer D represents an attribute of a class.

  • Wrong question. 11
    A variable declared to One class of CAN BE AN Extended Reference later class of that class. This variable Known AS IS
    A. protected
    B. derivable
    C. Closeable
    D. Polymorphic
    E. The above none of, BE A variable declared to of one class can never reference any other type of class, even an extended class
    correct answer: D my answer: a
    resolution: polymorphism means that the variable can take many forms. Under ordinary circumstances, Java is strongly defined, that is, once declared as a variable of type never become different types. This is an exception, polymorphic variable may be any type of a derived class (though not simultaneously, a variable may be changed from one type to another).

  • Wrong topic 12 is
    the Using The Reserved Word, Super, One CAN
    A. Access A parent class' constructor (S)
    B. Access parent class A 'Methods and Data instance
    C. A Child Access class' constructor (S)
    D. A Child Access class' instance the data and methods
    E. none of above at the
    correct answer: E my answer: B
    parsing: super reserved word provides methods and instance data access parent class (regardless of whether they are hidden) mechanism. Further, super constructor may be used to access parent class. Therefore, the correct answer is a combination of A and B, this is not an option, so the correct answer is E.

  • The wrong questions 13
    Why Should not declared BE AN abstract Method, Final?
    A. There's Nothing Wrong with doing SO
    B. not the Abstract Methods CAN BE Overridden They and the MUST BE IF A IS to BE Ever by Concrete class instantiated
    C. (So) Long AS at The Method, the Abstract Never Actually IS Used in by the any OTHER Method,, there's NO problem with doing the this
    D. of As Long AS at The the Abstract Method, IS declared in A Class (not AN Interface), there's Nothing Wrong with doing the this
    E. None of at The above
    correct answer: B my answer: E
    Analysis: in order to make the abstract methods become concrete, it must be covered. The final declaration is a method, it is impossible to cover it. This is a contradiction, is prohibited.

  • Wrong title 14
    the If class A AParentClass has the X-protected instance the Data, and AChildClass IS A derived class of AParentClass, the then AChildClass Access the X-CAN CAN But not to the redefine the X-BE A Different of the type.
    A. to true
    B. false
    correct answer: B I answer : a
    Resolution: a derived class can redefine any instance data or methods of the parent class. Version of the parent class is now hidden, but can be accessed through the use of super, just as in super.x in.

  • The wrong question 15
    . Although is CAN BE Inherited from classes One-Another, the even abstract classes, not in the interfaces CAN BE Inherited
    A. to true
    B. false
    correct answer: B My Answer: A
    resolution: Interface has all the attributes common inherited class has. Therefore, you can create a Interface inheritance hierarchy, just as you can create as a Class inheritance hierarchy. However, you can not do is instantiate they must implement.

    Pair peer review and

Grading

  1. Proper use Markdown syntax (1 point):
    • Do not use Markdown no extra points
    • A syntax error is not a plus (link does not work, does not form, the list is incorrect ...)
    • Typesetting confusion is not a plus
  2. Elements range (1 point) template
    • Missing "textbook learning and problem solving process" without points
    • Lack of "problem solving and debugging code in the process" without points
    • Managed code can not be opened without points
    • Missing "twinning and peer assessment" can not be opened without points
    • Missing "last week summed up the wrong title examination" can not be a plus
    • The lack of "progress bar" can not be a plus
    • Lack of "reference" can not be a plus
  3. Textbook learning and problem solving process, a problem 1 point

  4. Code debugging and problem solving in the process, a problem 1 point

  5. Week over 300 branches valid code (plus 2 points)
    • Submitted one week fewer than 20 times without points
  6. Other plus points:
    • Hair blog before Friday 1 point
    • Feelings, experience does not leave large empty 1 point
    • Typesetting fine plus one point
    • Progress bar records the learning time and improve the situation of 1 point
    • There are hands-on writing new code, add 1 point
    • After class choice has verified 1 point
    • Code Commit Message Specification 1 point
    • Learning the wrong questions in depth, add 1 point
    • Comments seriously, I can point out problems and blog code plus 1 point
    • Pair learning authentic plus 1 point
  7. Points:
    • Plagiarism buckle to 0
    • Cheat codes to buckle 0
    • Late assignments to buckle 0

Reviews

  • Worth learning problems or blog:
    • Students have been conscious of the error encountered on the screenshot to a variety of back to blog a lot easier, I always forget to knock back only once.
  • Code is worth learning or problem:
    • All roads lead to Rome, many students can come up with the code curve thinking, after listening to them explain really admire.
  • Based on score, I give this blog scoring: 11 points. Scores are as follows: +1 proper use Markdown syntax issues and problems in the teaching learning process of resolving +2 code debugging and Solutions process +2 feelings, experience does not leave large empty +1 +1 wrong questions to learn in-depth review..... seriously, I can point out problems and blog code +1. pair +1 authentic learning. there are after-school title verification +1, +1 record the progress bar.

  • Reference Example

Comments had students blog and code

  • Pair this week learning
    • 20182305
    • Pair Photo
    • Pair learning content
      1. Identify the classes and objects (class named object in general is a noun, a verb like behavior generally.)
      2. Static variables and static methods. (Local variables within the method can not be declared as static, static variables can be shared by all instances of the class; static methods can be invoked through the class name does not have to instantiate the object class.)
      3. The relationship between class (this chapter is mainly about the dependence relationship and aggregation relationship.)
      4. often this statement is used in the constructor.
  • Last week blog peer assessment case

Other (perception, thinking, etc., optional)

  • Each lesson exam made me very much, not only a matter of English unilateral, Java, there are many problems to be solved, because different versions of textbooks, from knowledge to find more trouble.
  • The fourth week in the past, can be used independently IDEA has written some programs, but still not complicated, command character class is still unfamiliar, but also to see much more practice.
  • Upon completion of the exercises and even once forget git junit configuration, and then configure git can only repeat, there is also urgent need skilled use of UML.

Learning progress bar

The number of lines of code (add / accumulate) Blog amount (add / accumulate) Learning time (add / accumulate) Important growth
aims 5000 rows 30 400 hours
the first week 200/200 2/2 20/20
the second week 350/500 2/4 24/38
The third week 512/1000 3/7 22/60
the fourth week 1158/1300 4/9 35/90

Reference material

Guess you like

Origin www.cnblogs.com/kv888777/p/11609370.html