20,182,301 2019-2020-1 "data structures and object-oriented programming" The first two weeks learning summary

20,182,301 2019-2020-1 "data structures and object-oriented programming" The first two weeks learning summary

Learning content summary

Chapter two

  • The difference between the print and println
    • system.out.println("换行");
    • system.out print ( "No Wrap");
  • Link string
    • String constants can not be more than one line. For example: system.out.println ( "Year in which Leonardo da Vinci invented" + "the parachute" +1515);
    • ps: + for addition and links, a distinction.
    • ps: the same content should be a distinction. E.g. :( "A piano has" + keys + "keys."); Represents: A piano has 88 keys.
  • Assignment
    • A value type can be assigned with another type of variable mismatch.
  • Basic data types
    1. Integer and floating-point type. There are four integer (int, short, long, byte) and two floating-point type (float, double) Note: Compared to the C language, Java more than a byte, byte data type is 8, signed , two's-complement integer representation; advantages: byte array type is used in a large space-saving, instead of the main integer, a byte variable because the space occupied by only a quarter of type int;
    2. Character: char.
      java 16-bit Unicode character set used to represent the character data. Ascll respect, Unicode broader, more general, while a subset of Unicode ascll, both general purpose.
    3. boolean type (Boolean).
      Boolean type and other types can not be converted into each other.
  • expression
    • Expression by the operators and operands, to perform a calculation. ps: similar to the C language, it is not too much to explain.
  • Data Conversion
    1. Assignment conversion. int dollars; float money; money = dollars; dollars may be converted to floating point. ps: not vice versa, is a narrowing conversion.
    2. Upgrade. float sum, result; int count; result = sum / count; count will be promoted to float. ps: numerical string similar.
    3. Cast. In front of the variable is incremented (int) or (float).
  • Read input data
    • 方法: String message;
      Scanner scan = new Scanner(System.in);
      message=scan.nextLine();

third chapter

  • String name; although the statement, but it does not actually exist.
    • Creation Method:
      1. String name = "George Bush";
      2. String name = new String("George Bush");
      3. String name = "George" + " " + "Bush";
      4. String name = new String("George" + " " + "Bush");
  • int and String statement.
    • int: num1 = num2 two objects
    • String: name1 = name2 same object, called each alias. Multiple references to variables can point to an object. Objects of the string class are immutable.
  • The method uses the object of the String class, master.
  • Package (picture library package): Book P50.
  • Random class:
    • float nextFloat (); return to 0.0 (inclusive) to 1.0 (exclusive) a random number between.
    • int nextInt (); returns a positive number and a negative number in a random number.
    • int nextInt (int num); returns a random number between 0 to num-1.
  • math class
    1. All methods of the Math class are static, that is to mobilize them by class name
    2. Random Math class has a method that returns a floating point random number of 0.0 to 0.1. eg: static double random ().
    3. If the root is negative, java be expressed as NAN.
  • Formatted output
    • NuberFormat DecimalFormat classes and classes may be used to format the information. ps: packet header plus import java.text.NumberFormat;
      • Method getCurrencyInstance NumberFormat two currency format object and returns the return percentages format object getPercentInstance
      • DecimalFormat class using the new operator to instantiate objects
        eg: DecimalFormat fmt = new DecimalFormat ( 0 ###.);
  • Enumerated type
    1. The character '-' and not part of '+' java identifier may be used Aminus Bplus and the like refers to a value
    2. Ordinal enumeration type used only internally, starting from 0
    3. method returns the ordinal number of a particular sequence with corresponding enumeration value.
      worth name method returns the name, i.e., the value corresponding to the identifier.
    • Example: enum Season {winter, Spring, summer, fall}; Season c1, c2, c3; c1.name or c2.ordinal.
  • Wrapper class
    • Automatic packaging provides automatic conversion between basic data types and the corresponding packaging

Textbook learning and problem-solving process

Chapter two

  • Question 1: How to make good use of boolean type?
  • Problem 1 Solution:
    public static void main (String [] args) {
    // TODO Auto-Generated Stub Method,
    boolean Sex = false;
    IF (Sex == to true) {
    System.out.println ( "you are a man.") ;
    } the else {
    System.out.println ( "you are a woman");
    }

}

  • Question 2: On page 26, "because the value is an integer, it automatically converted to a string," and asked if the value is a floating-point how to do?
  • Problems Solution 2:
    a float F = 0.1f;
    String max = "1.7";
    DecimalFormat new new DF = DecimalFormat; ( "######### #.")
    String S = df.format (Float.parseFloat as ( max) + F);
    System.out.println (S);
    NOTE: DecimalFormat represented digitally formatted

    third chapter

  • Question 3: use wrapper classes
  • Question 3 Solution:
    • Packaging primitive values ​​allow processing the object in the manner

Code debugging and problem solving in the process

  • Question 1: Common minor errors (own) appears in the code
  • Problem 1 Solution:
    1. import java.util. * can use scanner.
    2. When using press vim typing ctrl + c does not show the required press ctrl + q.
    3. No intermediate Scanner scan ..
    4. Random ran = new Random (); remember plus ().
  • Question 2: In a random number and format of the experiment, I use int type can not be formatted, it can be modified to float. why? (Picture -1, -2):

  • Problems Solution 2: DecimalFormat constructor with a string parameter type. So, I want to have a decimal point format will use float and double definition. Specifically to see the link.
  • Question 3: About DecimalFormat the pattern string (. "0 ####") can not be printed trailing 0, how do?
  • Question 3 solution: can be changed to 0.0000
  • Question 4: difficult to convert, how to solve? (Picture 3.1)

  • Question 4 Solution:

    • The method of a String instance charAt (int index) is a method that can be used to retrieve the character at a particular index.
    • the charAt () method returns the char value at the specified index. The index range is 0 ~ length () - 1.
    • Such as: (0) retrieval str str.charAt the first character, str.charAt (str.length () - 1) retrieves the last character.
    • Overall, string a, char c;
  • Question 5: Why will double 78.000001?


  • Problems Solution 5: 0.000001 corresponds 1e-6; represents a double accuracy.

Code hosting

Last week exam wrong question summary

The third week

  1. If x is an int and y is a float, all of the following are legal except which assignment statement? (If x is an int, y is the number of a float, all of the following assignment statement which is not lawful?)
    • A y = x;
    • B .x = y;
    • C .y = (float) x;
    • D .x = (int) y;
    • E .all of the above are legal (above all legal)
  • Right: B. The reason the wrong question: int less than float, it is not legitimate.
  1. What value will z have if we execute the following assignment statement int z = 50 / 10.00;? (If we execute the following assignment statement, z will get what value?)
    • A .5
    • B .5.0
    • C .50
    • D .10
    • E .none of the above, a run-time error arises because z is an int and 50 / 10.00 is not (all of the above error, because z is an integer and 50 / 10.00 is not, runtime error is generated)
  • Right: E. The reason the wrong question: The result is 5.00, but because z is int, it can not be converted.
  1. In order to create a constant, you would use which of the following Java reserved words? (To create a constant, which of the following would you use Java reserved word?)
    • A .private
    • B .static
    • 100 .int
    • D .final
    • E .class
  • Right: D
  1. You can not cast a String to be a char and you can not cast a String which stores a number to be an int, float or double. (You can not string cast to char type, nor can cast a string to an int , float or double type.)
    • A .true
    • B .false
  1. Every Iterator(迭代器) has a hasNext( ) method。
  2. An "alias" is when
    • A .two different reference variables refer to the same physical object
    • B .two different numeric variables refer to the same physical object
    • C .two different numeric variables contain identical values
    • D .two variables have the same names
    • E .none of the above
  • Right: A. Alias ​​refers to two different reference variables refer to the same physical object. Analytical: An "alias" occurs when there are two or more references to the same physical object so that by following either reference, one can read / write / modify the object (when the same physical object has two or more references, it will be "alias", wherein such a reference by following, can read / modify the object).
  1. These two ways of setting up a String yield identical results:

a) String string = new String("123.45");

b) String string = "" + 123.45;
A .true B .false

  • Right: true.
  1. The advantage (s) of the Random class' pseudo-random number generators, compared to the Math.random method, is that (compared with mathematical randomly, the advantage of the pseudo-random number generator is a random type)
    • A .you may create several random number generators (
      You can create several random number generator)
    • B .the generators in Random are more efficient than the one in Math.random (more efficient than random generator Mathematics)
    • C .you can generate random ints, floats, and ints within a range (may generate a random INT, INT and floating within a range)
    • D .you can initialize and reinitialize Random generators (
      You can initialize and re-initialize the random generator)
    • E .all but answer B
  • Right: E.

    the second week

  1. When executing a program, the processor reads each program instruction from main memory (when executing a program, each processor reads an instruction from the main program storage)
  2. Calculating storage capacity
    • Bit bit, a bit, a communication unit used.
    • Byte byte consists of eight binary bits, the computer is showing the basic unit of storage capacity.
    • K Qian, storage capacity per unit space, kilobyte, 1K = 1024 bytes.
    • Zhao M, megabyte, 1M = 1024K.
    • G 吉,gigabyte,1G=1024M。
    • T too, 1T = 1024G.
  3. Volatility is a property of RAM (random access memory variability nature)
  4. Java is an example of a (n) high-level language (high-level language) and fourth generation language (fourth generation languages)
  5. A unique aspect of Java that allows code compiled on one machine to be executed on a machine of a different hardware platform is Java's bytecodes (Java is its unique bytecode, which allows compiled on a different machine code execution on the hardware platform)
  6. The word "Public" is a reserved word. ( "Public" is a reserved word.).
  • error. Because the public is a reserved word is not capitalized
  1. In a Java program, dividing by 0 is a syntax error. (In Java programs, division by zero is a syntax error.).
  • error. He is a run-time error

the reason:

  • I think the very basic wrong title wrong the second chapter, I should be a good read textbooks, the textbook knowledge to master
  • I think the third chapter there have been many proper nouns, I need to take to strengthen English skills.
  • There are no wrong questions entirely sum up, because it is a careless mistake or an error similar to the above can not understand English or error.

    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

Comments template:

  • Worth learning problems or blog:
    • For the inquisitive spirit of difficulty
    • The difference between regular expressions and wildcards (see Wei classmates blog)
    • echo command (see cold classmates blog)
  • Code is worth learning or problem:
    • Code is now in the foundation stage, no discovery.
  • Based on score, I give this blog scoring: 16 points. Scores are as follows:
    • Proper use Markdown syntax for 1 minute
    • The complete feature templates 1 minute
    • Textbook learning and problem solving process 3 points
    • Code debugging and problem solving process in 5 minutes
    • Feelings, experience does not leave large empty 1 minute
    • Exquisite typography 1 minute
    • Progress bar records the learning time and improved 1 point
    • Comments seriously, I can point out problems and blog code of 1 minute
    • 1 minute in-depth learning the wrong questions
    • Pair learning authentic 1 minute
  • Reference Example

Comments had students blog and code

  • Pair this week learning
  • Pair learning content
    • Together to discuss the code, to discuss issues do not understand.
  • Last week blog peer assessment case

Other (perception, thinking, etc., optional)

This week learning content is simple, but also spent a lot of time.
There is a saying: "All things are difficult." I believe, "Hard work pays off," after I lay a solid foundation, I will learn in the future on a multiplier. Come on!
In addition to a series of commands linux really been worn temper, I believe I will therefore work after more calm.

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 69/200 2/2 30/20 Basis pitched
the second week 521/600 3/4 25/25 Learn basic writing code

Try recording "planned learning time" and "actual learning time" to the end see if you can improve their ability to plan. This study is very important work, is also useful.
Consuming an estimated equation: Y = X + X / N , Y = XX / N, training more often, X, Y will close.

Reference: Why is estimated that software engineering software so hard , software engineering estimation method

  • Plan study time: 20 hours

  • The actual study time: 30 hours

  • Improvements: linux already mastered the basic commands, write simple code. And while long enough, but the code is too little, spend too much practice in the infrastructure of the future to work hard in the code.

(Available see more modern software engineering courseware
software engineers the ability to self-evaluation form
)

Reference material

Guess you like

Origin www.cnblogs.com/zhaopeining/p/11569276.html