I have my blog, I am so mood.

xiaoxiao2021-03-05  58

Haha! ! ! Today, the weather is good, I have to find a blog, I will write something, so I found 9CBS, I was really convenient than Javacn! ! A nice start, but still is very habit, I feel so troublesome. Tab used to jump to the next frame, this is very uncomfortable.

I have been working for a long time, I found that you can use the shrinkage amount to get the Table function.

During the process of learning, you must record your experience:

0. Recently, a book is Java I / O, full English, it seems to be TMD trouble.

1. The first is the conversion problem of the Java inverse variable, some things told above are what I don't know: INT in Java is basically 32-bit. Although there are also byte, short, long, etc., but there is a bit problem with Byte and Short, although these two types are defined in Java, but actually store them, they are stored according to Int:

INT i = 42; Short S = i; // i is 32-bit, so if you want to convert it to a Short, you must (short) i; Byte B = i; // The same truth; Compiling these Lines Products the following errors: Error: Incompatible type for declaration.Explicit cast needed to convert int to short.ByteTest.java line 6Error: Incompatible type for declaration.Explicit cast needed to convert int to byte.ByteTest.java line 7

That is, stored in 32-bit ways (really wasting space), not only like this, and there is a problem:

BYTE B = 1 2; because 1, 2 is int 32, this also has problems because B is 8-bit, if this definition is defined: Byte B1 = 32; Byte B2 = 32; BYTE B3 = B1 B2 There is also a problem, although it defines B1, B2 is Byte, but B1 B2 this statement, Java still treats it as a 32-bit, so let Java make this thing well, must be Cast, that is, B3 = BYTE) (B1 B2), is it very depressed? It's very depressed ~ But why only variables have been wrong, constants are not wrong? Because of a constant an int is 32, he fixed the number of digits, only 32, which is 8 bits, fixed, constant, so don't make mistakes, but a variable INT b = 32, although 32 is 8 Bit, actually B = 1231321, the actual number of digits is changed, so Byte B3 = B1 B2, Java can only handle him as 32, and cannot be used as Byte, so I have to go wrong . I don't know if there is any problem like this. I don't say anything wrong, but I think so now.

2.

For (int i = 0; i

Generally, it is said that there is no real Byte, short, and they are stored in INT32. That's it, when CAST is actually b = b & 0x000000FF; in this way (for Byte), for Short, it is b = b & 0x0000FFFF.

转载请注明原文地址:https://www.9cbs.com/read-36630.html

New Post(0)