, I am dizzy, I am very dizzy ~~.
When I look at the JDK wishing code, I see some uncommon keywords, at least I rarely use them, or I will not use them. I found some materials and sorted them out.
Instanceof: it is useful to know the object type at runtime. When programming, we must determine the object type. One method is forced conversion. Another method is to use instanceof. But we have also seen a lot of illegal forced conversion with ourselves. You can't blame it if you don't do it during the test.
What is instanceof? For example, everyone on earth understands.
Public void test (object Value ){
If (value instanceof integer ){
// Enter this field if the value is an integer.
} Else {
//.....
}
}
If forced conversion is adopted
Public void test (object Value ){
Integer integer = (integer) value; // if you call text (object) {} elsewhere and pass in another object, an exception may be thrown here
Integer. // call integer regardless of 3721.
}
It's almost time for dinner.