1. Good Programming habits
Comment first, and then code !!
/**
Requirements:
Ideas:
Steps:
@ Autor
...
*/
Then you can start typing the Code. In addition, the Code should also have corresponding single or multiple lines of comments.
Binary Conversion
Octal: three binary bits indicate the number of one, which is often starting with "O ".
Hexadecimal: Four Binary bits indicate the number of one, often starting with ox
Convert 8 or 16 to 10: first convert to binary, then add the bit values of 1
[This type of computing is widely used in Oracle TRC files]
3 variable
In a word, the variable is a container
When will it be used?
When you store uncertain data
How to use it?
You need to open up a piece of space in the memory and use the following three aspects to determine:
① Data Type
② Variable name
③ Data
Note the following:
Hypothesis:
Byte B = 2;
B = B + 3;
This will prompt loss of precision, because B is a meal of one or two, 3 is int by default, there are four or two meals, perform B + 3, and the hermit will promote B to four or two, the obtained values are four or two, and then B = B + 3 is to pour the four or two meals into the bowl, and the precision is indeed lost.
4 Arithmetic Operators
(I) The use of string data and any data + represents the connection, and the final result will be a string
Tip: Enclose the fixed part with double quotation marks and connect it with the plus sign.
class Demo{public static void main(String [] args) { int a=2,b; b=++a; System.out.println("a=" + a +",b=" + b); }
(Ii) explanations of a ++ and ++ A (home and + homophone)
A ++: A goes out to dinner first, and then goes home for dinner.
+ A: A goes home for dinner and then goes out to play.