20172324 Java programming Second week of study summary

Source: Internet
Author: User
Tags naming convention

20172324 "Java Program design" The 2nd week study Summary textbook Learning content Summary
    • Learn about the use of strings and their concatenation and escape sequences.
    • The basic data type of java.
    • Defines the type of data transformation and how to implement its transformation.
    • Scanner class program.
    • Piled up a snowman.
Problems in teaching materials learning and the solving process
    • Question 1: When learning eg2.4, there is a problem, because this line of code is a bit long, relationship need to branch, I follow the method of the book found that the compiled "relationship" is actually "re lationship".
    • Problem 1 Solution: I realized that while I'm using + will not be able to line up in a row of strings, but only between strings and strings, a string inside cannot be a branch.
Problems in code debugging and the resolution process
    • Issue 1: When writing the TEMP program, it is no problem to check the content of writing, but the output has always been prompt error, there is an error is accidentally deleted the import of I, there is a problem "need Class,interface or enum solution" do not know how to do.

    • Problem 1 Solution: Write code files in non-Notepad, there are encoding format conversion problems. First build a Notepad program, and then paste the source code into the file, with the Javac class name. java compiler, Java file name run the program. This is caused by a problem with the encoding of the Java file. You typically use "Javac Firstsample.java" to compile UTF-8 encoded. Java source files. Without specifying the encoding parameter encoding, the GBK encoding is used by default. When compiled with GBK encoding to compile the UTF-8 file, it will UTF-8 encoded file 3 bytes of file header, according to the GBK of Chinese characters accounted for 2 bytes, English accounted for 1 bytes of the features decoded into a "garbled" two characters. This source file should be saved in Notepad as UTF-8 encoding
    • Issue 2: When writing the temp program, refer to eg2.7, where there is a final int BASE = 32,final double conversion_factor = 9.0/5.0 Later, the calculation is that there is no number but base and conversion_factor, so I added this to the program I wrote, and found that there is no syntax error can not be saved successfully.
    • Problem 2 Solution: In accordance with the eg2.8 method, the first step is to define the value of Fahrenheit, and then create a scanner class object that enters data from the keyboard. The place of calculation can also be calculated by using the data to output.
      I understand that base and conversion_factor should be a substitution value, but final means that the value of the parameter in the method body cannot be modified, and cannot be re-assigned, and it conflicts with the function of the scanner class, so it cannot be saved.
Code Hosting


(run result of statistics.sh script)

Last week's summary of the wrong quiz
  1. When executing a program, the processor reads each program instruction from the main memory .
    Parsing: Before executing the program, the program is first loaded from the secondary memory into the main storage so that the processor does not slow down by reading each instruction.
  2. Variability is the nature of random memory
    Analysis: Easy deformation refers to the storage of things in the power loss will disappear.
  3. The ability to obtain a stored item directly by referring to an address is called random access .
    Parsing: Random access (which can be said to be direct access) means that any item can be retrieved based solely on its address. random access is the form of access used by RAM and ROM memory. Tape uses sequential access.
  4. Java is an example of a fourth-generation language in a high-level language .
  5. Which of the following syntax is not legal in Java? s t a t i c main (string[] args)
    Parsing: The Java compiler will treat spaces as delimiters between entities, so the compiler does not treat "s t a T i C" as "static"
  6. Which of the following is true about Java syntax and semantics? The Java compiler can determine if you are following the correct syntax, but cannot determine the correct semantics.
    Parsing: Compilers in all languages can check for grammatical problems, but the computer does not understand semantics.
  7. Which of the following Java naming conventions is the best name for the "store customers" class? Storecustomer
    Parsing: the Java naming convention stipulates that classes should all start with uppercase letters, and that multiple word names should start with uppercase letters, while the remaining characters are lowercase. There should be no spaces between words, or connect with the "_" character.
  8. Which of the following is the best name for the variable "current value of a stock"? Currentstockval
    Parsing: Java allows the use of long variable names, but programmers must find compromises between long names and names that are too short to understand their use.
  9. Printing "println" as "PRINTN" will result in a syntax error
    Resolution If the Java compiler cannot understand the command, the compiler cannot convert it and respond with a syntax error.
  10. Java bytecode can be executed directly, while Java source code is not. (x)
    Parsing: Java source code and Java byte code are not executable. Both must be compiled or interpreted as machine code.
  11. In Java, reserved words can be redefined by programmers to represent other meanings that are different from their original meanings. (x)
    12. Which of the following is a valid Java identifier? I
    Parsing: Java identifiers are available in class libraries and are defined by programmers themselves, and can be any letter, number, underscore, and $ in their own defined identifiers, but cannot begin with a number.
Other (sentiment, thinking, etc., optional)

This week has been less than a lot of the first contact in the last week to be overwhelmed, replaced by the need to read the content of the book. In this regard my weakness is very obvious, because I have always looked at the back of the request of the experiment, and then probably can do not go to the drill, resulting in my last exam did not know the location of knowledge points ... The mistake was outrageous. Find the problem is going to correct, after the book should be thoroughly understand to do experiments, so fast and accurate, but also know where the problem is.

Learning progress Bar
number of lines of code (new product) Blog Volume (new product) Learning Time (new product) Important Growth
Goal 5000 rows 30 Articles 400 hours
First week 128/200 2/2 20/20
Second week 329/500 1/4 18/38
Resources
    • NBALIVE2001 's Blog
    • Explanation of "JAVAC compilation hint error required for class, interface, or enum"

20172324 Java programming Second week of study summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.