20,182,333 2019-2020-1 "data structures and object-oriented programming," the first four weeks learning summary

20,182,333 2019-2020-1 "data structures and object-oriented programming," the first four weeks learning summary

Learning content summary

  • 1 used to describe the relationship between classes and class structure: UML class diagram. Learn, learn the class name, the relationship between the operation (method) attribute (data) UML Unified Modeling Language This
  • 2. Classes and Objects: class is a blueprint for an object. It defines the variables and methods, is part of each object obtained when the class is instantiated. But the class is not reserved for the variable memory space. Each object has its own data space, have their own state.
  • 3. Analysis of the preparation for the class. (Examples of data encapsulation, visibility modifiers, and access modifier).
  • The method of analysis. (Return statements, parameters, local data, construction methods)
  • 5. The method design and method overloading a preliminary study.

Textbook learning and problem-solving process

  • Question 1: visibility modifiers
  • Problem 1 Solution: java reserved word modifier is used in the definition of a variable or method, specify the use of their specific characteristics. And some Java modifiers called visibility modifiers because they control access to class members. The public (public domain), indicating that the object can be referenced directly from the outside. Another example is private (private) to declare, you can not access the variable outside its scope is defined.
  • Question 2: aggregate object
  • Problems Solution 2: aggregate object by other objects, has-a relationship is formed
  • Question 3: this reference
  • Question 3 solutions: this usually points to an object that is currently running. Non-static method of a class is generally common to all objects of the class, but to call it by a specific object. So this point of reference objects, the method of execution is the dependent objects.
  • Analysis: Question 4
  • Question 4 Solution: The class consists of data declarations and declarations of the method, the method is a set of programming statements. The method java program is part of a class. Method declaration header includes a return type, method name and parameters of the method accepted list of statements constitute the method body is defined by the range delimited by curly braces.
  • Question 5: Return Value Method
  • Question 5 Solution: Return value type and method declarations must return the header values ​​match the type specified in the method. When defining classes, typically define a constructor to create the auxiliary instance class, a method commonly used in this configuration to initialize the variables associated with each object. Constructors have no return type, not even void type. When calling the method, the argument will be transferred to the copy process parameters.

Code debugging and problem solving in the process

  • Question 1: Junit not equipped
  • Problem 1 Solution: Click on the small light bulb, then with Junit on the line.
  • Question 2: How to git code in the cloud IDEA
  • Problem 2 Solution: Click settings (shortcut Ctrl + Alt + s) in the menu bar of IDEA

Code hosting

Last week exam wrong question summary

  • 1.
  • Analysis: class is the definition of program entity classes that represent things in the world / entity. Class definition includes instance data and methods. To use a class, you need to instantiate it. These examples are called objects. Therefore, an object instance of the class. Program code to interact directly with objects, not classes.
  • English: definitions (defined) instance data (sample data)
  • 2.
  • Analysis: Local variables are those who declare their methods of "local" variables, that is, they can only be accessed inside the method. Global variables are those that can be accessed from anywhere, while variable parameters are passed to the method. Examples of data can be viewed as a global variable of the entire object.
  • Word: variables (variables) accessible (accessible) initialized (initialization)

  • 3.
  • Analysis: can only be declared as an entity access to all the items in the class private class, whether they are instance data or method. In this case, since this method calls from only two other Rational methods (including constructors) in, they are declared as private, to facilitate information to a greater extent hidden. Note that the answer C is not the right answer, because the reduce method calls gcd method, a method in which it is called from a method other than a constructor.
  • English: constructor (the constructor) Division (Division)

  • 4.
  • Analysis: As A, a value of 0 (int) is enlarged to double. In the case of C, the add operation generates 0.3, then call doublefoo. D parameter list is illegal because it contains two pairs of parameters, instead of 1.
  • Word: contains (contain)

  • 5.
  • Analysis: form (formal parameters, formal parameters) of the method are those declared in the header. Actual parameters (actual actual parameters) in the call is actually transmitted to the expression method.
  • Words: arguments (parameters) parameters (parameters)

  • 6.
  • Analysis: declare any type constructors (even void) is a violation of syntax, so you will receive a syntax error.
  • Word: syntax (grammar) violation (violation)

  • 7.
  • Analysis: syntax error is the cause of it ";" the end of the symbol. Instead, it requires zero or more in brackets {} followed by the instruction. Abstract method will be ";" end, but the head does not define abstract methods.
  • Word: brackets (parentheses) instructions (instructions)
    abstract (abstract)

  • 8.
  • Analytical: Java allows no constructor defined in the case of class, but there is a default constructor in this case.

Comments had students blog and code

  • Pair this week learning
    • 20182317
    • 20182318
    • Pair learning content
      • How to git code in the cloud on the IDEA Code
      • How to use TDD test code
      • Discussion on book learning materials

Other (perception, thinking, etc., optional)

Learning this week makes me feel a little bit difficult, it might be a little busy week for other tasks. At the same time the class to listen carefully, not desertion, after class to see more textbooks, play more code.

Learning progress bar

The number of lines of code (add / accumulate) Blog amount (add / accumulate) Learning time (add / accumulate) Important growth
aims 10,000 lines 30 400 hours
the first week 56/56 2/2 20/20 The main learned simple operation Linux and how to write a simple java program code and upload it to the cloud
The second three weeks 331/407 3/5 23/43 I learned some classes and packages, but also understand the difference between Java and C language in some places
the fourth week 595/1002 2/7 20/63 IDEA and learned to use IDEAgit code cloud, but also learned TDD test
  • Plan study time: 20 hours

  • The actual study time: 20 hours

  • To improve the situation: this week the number of code obviously a lot more than last week, but still a little less, probably because of other things this week more, in short, need to take a lot of time to practice.

Reference material

Guess you like

Origin www.cnblogs.com/qianjiayu/p/11613633.html