What are the 30 common questions for Java beginners?
Java beginners what are the 30 common problems, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
Can I divide% by a decimal? Is there any difference between the effect of a + = b and a = a + b? Why does it take a lot of time to declare an array? Why don't Java libraries use random pivot quick sorting?
1.2 basic data types
q. Why is the result of-0swap 3 being 0 and the result of-0.0Universe 3.0 being-0.0? (note that the following result is 0 with a minus sign)
a. In Java, integers are represented by complements. There is only one representation of 0 in the complement. Floating-point numbers, on the other hand, are expressed in the IEEE standard, and there are two representations for 0, 0 and-0.
q. Can I divide% by a decimal?
a. Yes, of course. For example, if angle is a non-negative number, then angle% (2 * Math.PI) converts angle to between 0 and 2 π.
q. When a / b is a basic type variable, is there any difference between a + = b and a = a + b?
a. When the types of an and b are different, the effects of the two statements may be different. A + = b is equivalent to a = (int) (a + b), in which case an is int and b is float. But in the same case, a = a + b will compile the error.
1.3 conditional statements and loop statements
q. Why can't you use = = to judge that a string is equal?
a. This reflects the difference between base types (int, double, boolean) and reference types (String).
q. Is there any situation under which the curly braces of a sentence block cannot be omitted?
a. In the following example, the * * section of code is legal, and the second piece of code raises a compilation error. Technically, that statement is a variable declaration, not a statement, so an error is reported.
/ / legal for (int I = 0; I