20145331 Java Programming 2nd week of study summary

Source: Internet
Author: User

20145331 "Java Program design" The 2nd week study Summary textbook Learning content Summary

3.1 types, variables, and operators

• Note://(single-line comment),///(multiline comment ),/*/* (Javadoc Note) The content system does not run it, so you can use the annotated method for code correction, which I think is a very important application of annotations.

• Integers: Short (2 bytes), int (4 bytes), int is the system default type, Long (8 bytes)

• Byte: Byte (a byte is a 8-bit binary number)

• Floating point number (fractional): Float (4 bytes), double (8 bytes), and double is the default type for the system.

• Characters: char (Chinese characters, English characters are double-byte, must be added when defining character variables)

• Boolean: Boolean (there are only two results, True/false, respectively)

• Arithmetic operations: + 、-、 *,/,%

• Relational operations:>, >=, <, <=, = = (= is an assignment symbol, easy to confuse),! =

• Logical operations: With (&&), or (| | ), Non-(! )

• Bitwise operations: • With (&): Full 1 is 1, 0 is 0

• or (|): Full 0 is 0, 1 is 1

• Non (~): reverse.

• XOR (^): Same as 0, different 1

• Shift Left (<<): The corresponding binary code will move to the left of the corresponding bit, the lowest bit 0, the data will become larger.

• Arithmetic right Shift (>>): The corresponding binary code will move the corresponding bit to the right, the highest positive number is 0, the negative number is the highest bit 1, the data will be smaller.

• Logical Right Shift (>>>): After moving right, the highest bit must be 0.

• Increment, decrement: i++, I--、 ++i 、--I (attention to succession issues)

• Assignment Values: =, + =,-=, *=,/=,%=, &=, |=, ^=, <<=, >>=.

• Type Conversion

• Short-long is safe • Long-short must be cast

3.2 Process Control

• Order

• Branches: if...else, switch

• Loops: For, while, Do...while

• Small knowledge point: ignoring the symbol "\" causes the compiler to automatically ignore the next character.

Problems in teaching materials learning and the solving process

On the basis of the last time I printed Hello world, I wanted to print "Hello World" this time, and here is my initial code:

Program error, and then read the relevant teaching video, I in the original program in the printing part of the missing symbol added, the following improved code:

The compilation was successful, so I realized the magic of ignoring the symbol "\".

Next, I want to print the string \hello world\, the following is the initial code:

Failed again, please teach a bully to understand that the \ causes the compiler to ignore the original H and the last ", resulting in incomplete programs and syntax errors (unable to print the string), after debugging code as follows:

Other (sentiment, thinking, etc., optional)

Previously practiced in the C language course, I think this practice let me reap the most is to ignore the use of symbols and the use of annotations, I think in learning can not only learn a ballpark, to seize the details, and then more practice

Learning progress Bar

Second week 150/300 1/3 20/35 master the basic syntax of Java

Resources
    • Java Learning Notes (8th Edition)
    • Java Learning Note (8th Edition) Learning Guide

20145331 Java Programming 2nd 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.