20165334 Java Programming 2nd week of study summary

Source: Internet
Author: User

Study No. 20165334 "Java Program Design" 2nd week study Summary textbook Learning content Summary One, 2nd Chapter basic data types and arrays about identifiers
    • Identifiers consist of letters, underscores, dollar signs, and numbers, and are not limited in length.
    • The first character of an identifier cannot be a numeric character.
    • The identifier cannot be a keyword.
    • Identifiers cannot be true, FALSE, and Null (although true, false, and Null are not keywords)

      About data types
    • Logical Type: Boolean (logical value can only be ture or false )
    • Integer type: Byte, short, int, long
    • Character type: Char
    • Float type: float, double

    • Note: The default type of data with fractional parts is a double instead of float. So the float constant must be followed by the suffix "f" or "F".

      About data type conversions
    • The display type conversion operation must be used when assigning the value of a high-level variable to a variable of low level. Show the format of the transformation: (type name) the value to convert; for example: int x= (int) 34.89;

      Input and output data
    • Input Scanner reader=newScanner(System.in) (scanner can create an object that is blocked when the above method executes, and enter data in the command line to determine the return.
    • The output format has System.out.println() orSystem.out.print()

Difference: The difference between the two is that the former output data after the line, the latter does not break line.
If the string you want to output is longer, you can break the string into parts, and then use the collocated symbol: "+" to end them.
For example: System.out.println ("Hello," +
"Nice to meet You");

Array of element space allocated for Arrays name = new array element type [number of array elements];
     例如:    boy = new float[4];
Format of array initialization

such as: float boy[] = {1,2,3,4,5}; or float boy[] = new FLOAT[5];

Note: for • Char ' type array a,system.out.println (a) will not output a reference but will output the value of all elements of a

Second, third chapter operator, expression and statement main content
    • Operators and expressions
    • Statement overview
    • If conditional branching statement
    • Switch Switches statement
    • Looping statements
    • Break and Continue statements

Note: If a break statement is executed in a loop, the entire loop statement ends. If the continue statement is executed in a loop, the loop ends, that is, the statement following the continue statement in the loop body in this loop is no longer executed, and the next loop is transferred.

    • Arrays and for statements
      For (declares the loop variable: the name of the array) {

      ......
      }

Self-increment, decrement operator: ++,--
    • ++x (--x) means that the value of x is increased (minus) by 1 before using X.
    • x + + (x--) indicates that the value of x is increased (minus) by 1 after using X.
Problems in teaching materials learning and the solving process
    • Problem 1:P32 after class exercise programming compilation error
    • Issue 1 Solution: Based on the error, check the code to find that you have char a=‘你‘,b=‘我‘,c=‘他‘; written char a=‘你‘,char b=‘我‘,char c=‘他‘; , and once again feel the importance of the careful typing code. As follows

Problems in code debugging and the resolution process

A diagram error occurred while compiling code Example3_1

The error indicates that you have written the name of a variable incorrectly, and that the change is successful.

Code Hosting

(run result of statistics.sh script)

Last week's summary of the wrong quiz

In this blog post

Learning progress Bar
lines of code (new/cumulative) Blog Volume (Add/accumulate) Learning Time (new/cumulative) Important Growth
Goal 5000 rows 30 Articles 400 hours
First week 80/100 1/2 20/20
Second week 300/200 2/2 20/38
Third week
Week Four
Resources
    • Java Learning Notes (8th Edition)

    • Java Learning Note (8th Edition) Learning Guide

20165334 Java Programming 2nd week of study summary

Related Article

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.