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

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

Learning content summary

  1. UML class diagrams can help expose the relationship between the contents of the program in class and class
  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. Modifier: java is a reserved word, used in the definition of variables or methods, their specific use of specified characteristics. Declared as private, you can not access the variable outside its scope is defined.
  4. Interface: The interface object is defined on a common set of object operations, namely the establishment of an interface object to perform a set of services to other systems.
  5. 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.
  6. Other objects of the aggregate object formed has-a relationship
  7. Java class library does not try to write predefined classes, methods function definition objects can be achieved.
  8. Learn, learn the class name, the relationship between the operation (method) UML Unified Modeling Language This attribute (data).
  9. Learning packaging and package implemented modifiers (described in visibility modifiers public and private represented in UML public visibility +, - represents private visibility)
  10. Learning access and modifier methods, accessor is getX, the modifier is setX. The method naming convention here the first letter of the name of the instance variable capital.
  11. Analysis methods to understand, like the 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.
  12. The return value type must declare the header and methods consistent return value type specified. 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.

Textbook learning and problem-solving process

  • Question 1: What is the interaction? Interface is how to interact with objects?
  • Problem 1 Solution: The interface is a declaration of a series of methods, is a collection of some of the features of the method, an interface features not only the method of implementation, the interface is a java object-oriented mechanism provided (like abstract methods and constant values set of methods stated, stated methods and classes defined similar.
    role:
    (1) achieve the same behavior unrelated classes via the interface, without having to know the object corresponding to the classes.
    (2) may indicate the need to interface to a plurality of classes implemented method.
    (3) through the interface object you can understand the interface, without having to know the object corresponding to the class.

  • Question 2: return statement how to use? Why can not return once more actual parameters?
  • Problem 2 Solution: The return value type of the method must be declared and consistent method returns the specified header value 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?
  • Question three solutions: Static variables
    may be understood as static variables class variables (independent of the object), and instance variables of a particular object belongs.
    Static variables there are two cases:
    the static variable is the basic data type, in this case outside the class without having to create instances of the class can be used directly
    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
    different from the class variables, methods (static methods and instance method) only one in memory, regardless of how many instances of the class, are a common method.

Code debugging and problem solving in the process

  • Question 1: Code book. What does it mean implements Complexity
  • Problem 1 Solution: deleting implements Complexity on it. Different extends and implements of:
    extends the parent class is inherited, as long as that class is not declared as final or will be able to inherit the class is defined as abstract, you can also call the parent class initialization this.parent (). And overwrites variables or functions of the parent class definition. Such benefits are: architects define a good interface that allows engineers to achieve it. The entire project development efficiency and reduce development costs significantly.

JAVA does not support multiple inheritance, but the interface can be implemented, so we should use implements, inheritance can only inherit a class, but implements can implement multiple interfaces, separated by a comma on the line. Achieve parent class or subclass can not override methods of the parent class variable. Even if the same subclass definition parent class variables or functions, the parent will be substituted out.

  • Question 2: or code on the books, in vim running crazy mistakes
    -

  • Problem 2 Solution: Run the idea found written in the void int
  • Running success!

Code hosting

(Statistics.sh script run results screenshot: Because summer vacation idea is not to download the full version, a lot of plug-ins are not, the amount of code is also different from other people setting method, after going to download a full version, after shots up)

Last week exam wrong question summary

  • Wrong question 1

  • Analysis: Objects are instances of classes. Program code to interact directly with objects, not classes. Had misunderstood!
  • 2 wrong questions

  • Analysis: hand slipped the wrong point, the scope of a variable is limited in its method declaration of a local variable is of course friends.
  • 3 wrong questions

  • Analysis: Examples of data entities is an integral type, may be any available type (either a primitive type or object type), the type may be a public or private type. By way of example using the object data, which allows the construction of classes on the basis of other classes. If a class has another class instance data, this relationship is referred to as a has-a relationship. This summary of this week, there was the question of when do not think.
  • 4 wrong questions

  • Analysis: A, D no parameters, equals can pass a string comparison.
  • Wrong question 5

  • Analysis: The declaration of any type constructor (or even void) is a violation of syntax.
  • 6 wrong question

  • Analysis: Title engage in counter, in the form of parameters is found in the method header parameters, actual parameters of the method call parameters (parameters passed to the method).
  • 7 wrong question

  • Study: All Java methods return a single item, whether it is the basic data type of the object or void. Reserved words continue for the remainder of the test conditions and exit the loop again.
  • 8 wrong question
  • Analysis: should not end with a semicolon, more instructions should be added after the {}.
  • Wrong question 9

  • Analysis: Examples of data are globally available to all class methods, these methods need to declare
  • 10 wrong questions

  • Analysis: How is the external interface to interact with the proxy object. For those items to interact only public statement by the class definition.
  • 11 wrong questions

  • Analysis: Java allows the definition of a case without the class constructor.
  • 12 wrong questions
  • Analysis: The constructor may contain non-value returned by the return statement. At that time I do not understand when to come.

Pair peer review and

Worth learning problems or blog:

  • Good on small interface issues raised, indicating that reading watching very carefully, I like to learn from him.
  • Problem: The problem described is relatively simple, can be more in-depth analysis of what

Code is worth learning or problem:

  • Code practice less, hope more practice
    -based score, I give this blog scoring: 13 points. Scores are as follows:
  1. Proper use Markdown syntax (1 point)
  2. Elements range (1 point) template
  3. Textbook learning and problem-solving process (plus 3 points)
  4. The code debugging and problem solving process (plus 3 points)
  5. Other points (5 points)
  6. Learning time and improvements in recording progress bar (1)
  7. Feelings, experience does not leave large empty (1)
  8. There are hands-on writing new code (1)
  9. Typesetting fine (1)
  10. Learning the wrong questions in depth (1)
  11. Comments seriously, can point out problems and blog code (1)
  12. Knot authentic (1) of learning

Comments had students blog and code

  • Pair this week learning
    20,182,314
  • Pair Photo
    -

  • Pair learning content
  1. Statistics idea the amount of code issues
  2. the use of idea
  3. Discussion interface issues

other

  1. This week many kinds of things, been slacking off on the program. During the National Day hopes to timely review, they may say.
  2. Summer downloaded idea seems a little problem, a good multi-functional deletion studies well studied.

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 42/42 2/2 20/20
The third week 394/471 2/4 25/45
the fourth week 394/471 2/6 20/65
  • Plan study time: 20 hours

  • The actual study time: 20 hours

  • Improvements: shorten the learning time, we need to work harder

Reference material

Guess you like

Origin www.cnblogs.com/weiii/p/11612837.html