20145320 "Java Program Design" 2nd week study Summary textbook learning content Summary 3.1 types, variables, and operator base types
Integer (short, int, long), Byte (byte), floating-point number (float/double), character (char): Chinese characters, English characters are double-byte
Boolean (Boolean): True/false in a Boolean type cannot be operated with other types
Comments
Three notes//: Single line,/**/: MultiRow,/** */:javadoc document comments
Constant
Integers can be binary (0bdddd), octal (0DDD), Decimal (dddd), hexadecimal (0XDDDD), in Java are signed under integers, no unsigned int, etc.
Floating-point number scientific counting method
Decimal (such as 1.4) The default type is double,1.4f or 1.4F is the type of float
Characters can be represented by Unicode character encoding (code point).
Operator
Arithmetic operations + 、-、 *,/,%
Relational operations:!=>, >=, <, <=, = =
Conditional expression? Return value when established: return value on Failure
Logical operation: The result of the operation is a Boolean value: TRUE or FALSE, with (&&), or (| | ), Non-(! )
Bitwise operations: The result of the operation is a bit string (bit vector)
With (&): All 1 is 1, 0 is 0, or (|): 0 is 0, 1 is 1, non (~): Inverse code situation, XOR (^): Same as 0, difference is 1, left shift (<<): Right to 0, arithmetic right shift (>>): Right shift, positive number is the highest bit 0, Negative number of the highest bit 1; logical right Shift (>>>): After right shift, the highest bit is always 0, increment, decrement: i++,i--++i,--I
Assign value
+=,=,-=, *=,/=,%=,&=, |=, ^=, <<=, >>=
Type conversions
Short and long are safe, long and short must be cast
There are different types in the expression, whichever is the longest, others are type-lifted (Promote)
3.2 Process Control structured programming
Contains three types of statements
Order: The computer structure determines that statements are executed sequentially, and are normally executed sequentially.
Branch: A branch used to handle exception cases.
Loops: Executing the most commonly used statements
Branch
Type if, If...else, If...else If, switch...case, switch can be used for integers, characters, strings, etc.
The default branch of the various situations to meet the principle of non-repetition, not missing
Cycle
Type for, while, do...while, break/continue mate tags can achieve goto effect, Goto can be used to jump out from multiple loops
Problems in teaching materials learning and the solving process
Sometimes we encounter when assigning a value that exceeds the defined range, for example, if we can easily exceed its upper limit of 127 when defined as byte, or if the precision is not correct, for example, the value we assign when using float in the definition exceeds its precision, thus making an error
Problems in code debugging and the resolution process
Yi Know i = 8, but what about J? 8? Or is it 8.8?
Results
Something went wrong! Why, is it not mandatory to convert int i into a double type j?
Learning progress Bar
|
Lines of code (new / cumulative) |
Blog volume (add / accumulate) |
Learning Time (new / cumulative) |
Important growth |
Goal |
3500 Line |
Articles |
Approx. hours |
|
First week |
300/300 |
1/1 |
20/20 |
|
Second week |
500/500 |
2/2 |
40/40 |
|
Third week |
|
|
|
|
Week Four |
|
|
|
|
Resources
- Java Learning Notes (8th Edition)
- Java Learning Note (8th Edition) Learning Guide
- ...
20145320 Java Programming 2nd week of study summary