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

20,182,309 2019-2020-1 "data structures and object-oriented programming," the second and third week learning summary

Learning content summary

  • Iterator
  • Class definition and instances of
  • get、set
  • return
  • Constructor of the class
  • Static class and static methods
  • Dependency, the polymerization
  • this
  • Method overloading
  • debugging

Textbook learning and problem-solving process

  • Question 1: How to compare Boolean data type
  • Problem 1 Solution: call the method equals, returns a Boolean value

Code debugging and problem solving in the process

  • Question 1: (int) Math.random only return 0
  • Problem 1 Solution: Finally, rounding

Code hosting

Last week exam wrong question summary

  • 1.In order to preserve encapsulation of an object, we would do all of the following except for which one?

A. The instance the Make Private Data
B. The Methods in the Define The class The instance to Manipulate Data Access and
C. The Methods of the Make The public class
D. The class the Make Final
E. The above All of the preserve encapsulation
D, encapsulation means class contains data and methods needed to manipulate the data. In order to properly retain the package, instance data should not be accessed directly from outside the class, instance data is private, and define methods to access and manipulate data instance. Further, access data instance and method of operation are disclosed, so that other classes can use the object. Reserved word "final" for controlling inheritance, regardless of the package.

  • 2.If a method does not have a return statement, then

A. IT Will Produce A syntax error When Compiled
B. IT MUST BE A void Method
C. IT CAN Not BE Called from Outside The class that defined The Method
D. IT MUST BE defined to BE A public Method
E. IT MUST BE AN int, Double, or String method, float
B, all methods are implied, so there must be a return statement. However, if the programmers want to write a method that returns nothing, so no return statement, then it must be a void method (as its head has a void return type of the method).

  • 3.Consider a sequence of method invocations as follows: main calls m1, m1 calls m2, m2 calls m3 and then m2 calls m4, m3 calls m5. If m4 has just terminated, what method will resume execution?

A. M1
B. M2
C. M3
D. M5
E. Main
method B, the method terminates, control will continue to use the method is invoked. In this case, m2 calling m4, so that when m4 is terminated, m2 will be restored

  • 4.Visibility modifiers include

A. Public, Private
B. Public, Private, protected
C. Public, Private, protected, Final
D. Public, protected, Final, static
E. Public, Private, protected, static
B, public, Private and protected control variables and methods visibility. final controlled variable, whether or class method may further change or rewriting invisible. Static variables or methods to control whether the associated instance of the class or class itself.

  • 5.What happens if you declare a class constructor to have a void return type?

A. LIKELY by You'll the receive A syntax error
B. Will the compile with Program A of The warning, But you'll GET A Runtime error
C. There apos Nothing Wrong with Declaring A to BE constructor void
D. Of The class' Will default constructor BE Used One of you're at the INSTEAD Declaring
E. None of above at the
a, declare any type of constructor is even void is a violation of grammar, you will receive a syntax error

  • 6.The following method header definition will result in a syntax error: public void aMethod( );

. A to true
B to false.
A, the reason it is a syntax error ";" end symbol. Behind it needs {}, there is 0 or more instructions in parentheses. Abstract method will be ";" at the end, but this does not define the first abstract methods.

Pair peer review and

  • Worth learning problems or blog:
    • Learn deep, they have a method
  • Code is worth learning or problem:
    • Reduce the use of inheritance rewriting the code
  • Based on score, I give this blog scoring: 10 points. Scores are as follows:
    • Proper use Markdown syntax (1 point)
    • Elements range (1 point) template
    • Textbook learning and problem solving process, a problem 1 point
    • Code debugging and problem solving in the process, a problem 1 point
    • Week over 300 branches valid code (plus 2 points)
    • Typesetting fine plus one point
    • Code Commit Message Specification 1 point
    • There are hands-on writing new code, add 1 point
    • Pair learning authentic plus 1 point

Comments had students blog and code

  • Pair this week learning
    • 20182331
    • Pair learning content
      • IDEA learning operation
      • Quickly generate class
      • Integrated Development
      • Use IDEA fast processing error

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 138/138 2/2 25/25 Learn to write and upload code will compile a simple program output
the second week 88/226 1/3 30/55 Since the file name can not be too long
The third week 898/1124 2/5 35/90 Function much like Java classes and methods inside the C language
the fourth week 632/1756 2/7 30/120 Inheritance can be used to simplify the repeated code extends

Reference material

Guess you like

Origin www.cnblogs.com/blueflameashe/p/11612581.html