Java exercises 10.25, java10.25
Java question 10.25
1,
In fact, this question examines two major principles of the same two: the same method name and the same parameter type.
Subclass return type is less than or equal to the return type of the parent class method,
The subclass throws an exception that is less than or equal to the parent class method and throws an exception,
The sub-class access permission is greater than or equal to the parent class method access permission.
2,
Java divides memory into two types: stack memory and stack memory.
Some of the values defined in the functionThe variables of the basic type and the referenced variables of the object are allocated in the function stack memory.. When a variable is defined in a code block, java allocates memory space for the variable in the stack. When the scope of the variable is exceeded, java will automatically release the memory space allocated for the variable, and the memory space can be used for another use immediately.
Heap memory is used to store objects and arrays created by new.. The memory allocated in the heap is managed by the Java Virtual Machine automatic garbage collector. After an array or object is generated in the heap, you can define a special variable in the stack. The value of this variable is equal to the first address of the array or object in the heap memory, this special variable in the stack becomes an array or object reference variable. Later, you can use the reference variable in the stack memory in the program to access the array or object in the stack, the referenced variable is equivalent to an alias or code name for an array or object.
The referenced variable is a common variable. When defined, the memory is allocated in the stack. The referenced variable is released outside the scope of the program. Arrays and objects are allocated in the heap. Even if the program runs outside the code block where new statements are used to generate arrays and objects, the heap memory occupied by arrays and objects is not released, when the array and object do not reference a variable to point to it (for example, when the previous referenced variable x = null), it becomes garbage and cannot be used again, but still occupies the memory, it was released by the garbage collector at an uncertain time. This is also the main reason why java accounts for memory usage.
The above paragraph comes from a Java programming book. In fact,
The variables in the stack point to the variables in the heap memory. This is the pointer in Java..
In summary, objects are stored in heap memory, and referenced variables are stored in stack memory. Stack memory points to heap memory.
3,
For the sake of running rate, the java compiler will put frequently accessed variables into the cache (strictly speaking, it should be working memory), and read variables will be read from the cache. However, in multi-threaded programming, the values in the memory may be inconsistent with those in the cache. Volatile is usedVariable restrictions can only be read from memoryTo ensure that the values are consistent for all threads. HoweverVolatile cannot guarantee atomicity and thread security..
4,
Dynavalidatexceptionform dynamic Verification Form Validation meaning
5,
It's always silly to tell you how to reload and rewrite it. It's always based on overriding and overload. Chinese is really profound and profound. Overload: as long as the method name
ConsistentOther parameters (parameter list and return value. Overriding: only implemented functional code
Inconsistent, Other (function name, parameter list, return value type) must be consistent.
6,
Seven major measures encouraged by Hibernate are optimized:
1. Try to use Upload-to-one instead of using one-to-one
2. flexible use of one-to-one Routing
3. Do not use one-to-one instead of one-to-one.
4. Configure the object cache without using the set Cache
5. One-to-multiple use of Bag multiple-to-one use of Set
6. Inherit and use show polymorphism HQL: from object polymorphism = "exlicit" to avoid investigating all objects
7. Remove large tables and use second-level cache
7,
0Xf000000000000000 completion code 1111000000000000000000000000000000000000000000000000000000000000
0x7fffffffffffff completion code 0111111111111111111111111111111111111111111111111111111111111111
A-B = a + (-B) =
1111000000000000000000000000000000000000000000000000000000000000 +
1000000000000000000000000000000000000000000000000000000000000001 =
10111000000000000000000000000000000000000000000000000000000000001 (high overflow)
The result is
0111000000000000000000000000000000000000000000000000000000000001 =
2 ^ 62 + 2 ^ 61 + 2 ^ 60 + 1
The answer is C code verification 8,
C. Because the first parameter of the replaceAll method is a regular expression, and "." represents any character in a regular expression, all the characters in the preceding string are replaced "/". If you want to replace only ".", it will take a long time to write it "\\.".