java interview summary knowledge points

The difference between == and equalse

== compares whether the addresses of the two objects are the same. The practice source code of equalse is to first compare whether the addresses of the two objects are the same, and return true if they are the same. Otherwise, judge whether the values ​​are the same, return true if they are the same, otherwise return

The difference between

& and && && is a bitwise operator, && is a short-circuit operation, when the first condition is false

, the second condition will not be executed.
& in the conditional judgment, both conditions will be executed.

The value in switch() only supports string type after jdk1.7.

There are two ways to jump out of the for loop. One is to use the ok: mark in front of the outer for loop code block, and
use break ok where the conditions are met in the inner for loop; directly jump out of the outer for loop.

Method 2: Add a boolean type variable directly to the variable of the outer for loop to judge boolean isFalg = false;
for(int i=0;i<10&& !isFalg;i++){
    isFalg = true;
}

A .java file except for In addition to the inner class, there can be many class classes, the only limitation is that the class is modified with the default modifier. There can only be one public modified class in a java file.

The difference between static variables and instance variables:

the addresses of instance variables are different when they are compared, and equalse will return true for the comparison value.





Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326888576&siteId=291194637