First, final1.final variables:When you define a variable in a class and precede it with the final keyword, it means that once the variable is initialized it is immutable, and the immutable meaning is immutable for the base type, and the reference to
Variable
First, illegal forward refrence
A very Kentson compilation error was encountered when writing a class the day before yesterday (after the problem is simplified):
Punlic Final Class constants{
public static int VAR2 = VAR1 + 1;
public
Static
Modifier variables: Static variables are initialized as the class loads, only one in memory, and the JVM allocates only one memory at a time, and all classes share static variables.
Modification method: Exists at the time of class loading
1. static variableClass member variables can be classified by static or not. One is static modified variables, such as static variables or class variables; the other is a variable that is not modified by static, called an instance variable. The
Interface (interface): The interface is equivalent to class. All the methods in the interface are abstract methods. When you declare a method in an interface, you can use the abstract keyword or you can not use it. Typically, the abstract keyword
StaticWe use the static keyword in two special cases:① we want to use a store to hold a specific data, no matter how many objects you want to create, or if you don't create the object at all.② We need a special method that is not associated with any
Final considerations:
1. abstract and final cannot modify a class at the same time.
2. the modifier ensures that the method cannot be overloaded by the quilt class. The methods that have been modified by private and all the methods included in the
Final is a reserved keyword in Java that can declare member variables, methods, classes, and local variables. Once you have the quote declared final, you will not be able to change the reference, the compiler will check the code, and if you attempt
What is this: represents the current object. This has two main locations:Constructor: represents the currently created objectmethod: Which object calls the method in which this is, then this represents which object.When an object is created, the JVM
1. Static modification method: the static modification method is called the static method. For static methods, you can use the class name and method name to access them. We recommend that you use this method.
2. subclass can inherit the static
atitit Agent CGLIB Dynamic proxy aspectj static proxy differences 1.1. Span style= "font-family:arial; Color: #ff0000; Font-size:10.5pt ">a op agent is divided into static agents and dynamic agents of two major categories, static proxy to
Today, when I was sorting out the materials, I suddenly found the notes I made when I was reading think in Java (Java programming ideas). I thought it was good and I would like to share it with me, it is also the best memory of my consistent
List of interview questions:First, Javase common face questions1, Static and final difference? When you use the final keyword to decorate a variable,Is the reference immutable, or does the referenced object not change?2. What is the difference
In Java, the final keyword can be used to decorate classes, methods, and variables (including member variables and local variables). Here's a look at the basic usage of the final keyword in three ways.1. Modifier classWhen a class is decorated with
interview: Implementing a Singleton mode in JavaAfter the interview series update, finally ushered in our first phase, we will close to the "sword refers to offer" topic to bring you the explanation of Java, individual or very recommended "sword
The Java language provides an interface (interface) mechanism. This interface mechanism makes Java object-oriented programming more flexible. We can use interfaces to define the representation of a class, but an interface cannot contain any
Java14-java Syntax Basics (13) interfaceFirst, the interface1, the role of the interfaceJava is not supported for multiple inheritance and only supports single inheritance for security reasons and for simplifying the structure of the program.
In the Java keyword,static and final are two of the keywords we have to master. Unlike other keywords, they are used in a variety of ways, and can improve the performance of the program and optimize the structure of the program in a certain
The access control for the class:
There are four types of access controls, but for external classes , only the public and the default are sufficient.
Public means that the class can be used by any class.
When a class is defined as
1. Annotations (note: 5)
Annotation use style (annotation style)This check allows you to control the style of the annotations you want to use.Missing deprecated (lack of DEPRECAD)Check whether the Javadoc markup for the java.lang.Deprecated
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.