|
1. Generally refers to the final class
final class a {
}
Such classes are not allowed to inherit.
final data is a "compile-time constant" that never changes
The final method is to lock the method to prevent any class from modifying its meaning.
The final parameter is the object to which the parameter reference cannot be changed in the method
2.static
Static field
Generally, the static method we commonly use is not a THIS method.
Its methods cannot call non-static methods internally, in turn, in non-
Static methods can call static methods internally, it is not sent through the object
Send message
A bit like global functions in C.
The other is static data, and his initialization is not much different from general data.
Just added a static. As for the memory, I think it looks like
Static storage (always existing data), while the java object itself is not stored
Here it is.
I only watch JAVA for two weeks, so I don't understand a lot, just communicate.
Please advise |
|