- The difference between JDK and JRE:
A: The JDK is the Java language Development kit that contains the JRE and development Kit (Java,exe, etc.), the Java language of the runtime environment, including the JVM and the core class library, the JVM is a Java virtual machine, to ensure that the Java cross-platform nature
- Is the JVM cross-platform?
JVM is a Java virtual machine, different operating systems corresponding to the JVM, the JVM does not have cross-platform
- Reserved words
Reserved words are keywords that are not yet used, and may be used in later versions of Java, Goto and const
- Features of the Java language:
Fully object-oriented, cross-platform, open source, safe, reliable, high performance, multi-threading, robustness,
- Is main the key word?
No, main is the name of the main function, which can be recognized by the virtual machine and is the entrance to the program execution.
- The difference between path and classpath:
The PATH environment variable is configured with the execution path of the executable file. exe, and the bytecode file execution path for the classpath configured Java language post-compilation sound field
- The most basic storage unit for a computer is: bytes
Computer direct recognition of binary: binary
- What is the difference between a variable and a constant:
The value of a variable during the operation is varied, can be assigned multiple times, and the constant is fixed.
- Categories of variable data types:
Variables need to be defined first, then assigned, and then used
Basic Data type: 4 Class 8 kinds of byte short int long float double char Boolean
Reference data types: arrays, classes, interfaces
- Constant classification:
Custom constants: Constants defined by themselves through final adornments
Literal constants: include integers, decimals, booleans, characters, strings
- Range of byte: 128 127
Range of char: 0 65535
- Long is 8 bytes, float is 4 bytes, why long is smaller than float
The underlying arithmetic rules are different
- + + and--the use of:
When used alone, the same as before and after
To participate in the operation, the first is self-added or self-reduction, after the first to participate in the operation, in the self-added or self-reduction
- Logic | and short-circuit | | The difference
| No matter what the front is, it's true. Arithmetic, | | The front is true and does not participate in the operation, improving the efficiency of the operation
- The difference between logic & and short-circuit &&
& regardless of the front is really will arithmetic, && front if False, the back of the not participate in the operation, improve the efficiency of the operation
- The difference between while and dowhile,for:
Do While is the first execution after the judgment
While and for the first judgment after execution, the For loop ends, its defined initialization condition can no longer be used
- The difference between break and continue:
Break is completely out of the loop, continue is jumping out of the loop, making the next loop
- The difference between method overloads and method overrides:
Method overloading is a method with the same name in the same class, with a different argument list, regardless of the return value
Method overrides between subclasses, when a subclass appears and the parent class declares exactly the same method, becomes a method override, overriding requires that the return value be the same or that there is a word parent class relationship
- Construction method, the Set method can assign a value to a member variable, the difference between the two assignments?
The main function of the construction method is to initialize the object, assignment is only his part-time work, can also not assign value
- The difference between a static block of code and a block of construction code:
Static code blocks belong to a class, initialize the class, and the class is loaded and executed only once
Constructs a code block to initialize the object uniformly, and executes once for each time it is created
- Four types of permission modifiers:
Public PROTECTD Default Private
- The difference between = = and equal:
"= =" is a comparison operator that can compare basic data types, have a reference data type that can be compared, the base data type compares a numeric value, and the reference data type compares the address value
Equal is a method that overrides the equal method to compare the contents of an object, and if there is no override the equal method that will call object, compare the address value
- The difference between string and StringBuffer and StringBuilder:
String is a special reference data type, is a sequence of characters can not be changed, no buffer, once created can not be changed, even if the re-assignment is not changed on the original basis, but instead of re-created an object, will refer to this new object, waste space, inefficient
StringBuffer and StringBuilder are a container that is a variable sequence of strings
StringBuffer, thread-safe, low-efficiency,
The bottom of the StringBuilder is a character array, the thread is unsafe, the efficiency is higher
- Collection system:
- The difference between ArrayList and LinkedList:
ArrayList data structure of the underlying data, query slow, and delete quickly
LINKEDLISTD Bottom is linked list, delete fast, query slow
- A brief introduction to the data structure:
Stack: Advanced post-out, press stack, bounce stack
Queue: FIFO
Linked list: Each element points to the next element
Arrays: A fast contiguous storage area
- Thread and Process Multithreading:
A process is an executing program, each program has at least one control unit, a running program
A thread is a control unit in a process that controls the execution of a process and is the execution path of a process.
Multithreading: Multiple execution paths for a process, each execution path is a thread
- Multithreading concurrency and multithreading parallelism:
When two or more tasks send requests, the CPU can execute only one, alternating these tasks, and the CPU switches execution at high speed, which is multithreading concurrency
Multi-threaded parallel, two or more tasks executed simultaneously, provided the multicore CPU
- Features of Multithreading: randomness and delay
- Two ways to implement a thread:
Inherit the thread class, the advantage is inheritance, code is simple, can directly use the method of thread, the disadvantage is poor extensibility, should inherit the thread class, can not inherit other classes
The advantage of implementing the Runnable interface is that the extensibility is strong, the disadvantage: The code is more, cannot directly use the thread class
- The life cycle of a thread:
New ready to run (may block and wait) death
- The difference between sleep and wait:
Sleep is to get the thread asleep, must give the corresponding time, time to the automatic wake, sleep without giving up the CPU execution right
Wait is to let the thread wait, can pass the parameter also can not pass the parameter, the argument is lets wait after the specified time, needs to be awakened, waits the time to abandon the CPU execution right
- To suspend a thread:
Wait: Let the thread wait, wait for the time to abandon the CPU's execution right
Yield: Let the thread pause and execute other threads
- What is an IO stream:
Used to interact data between hard disks and memory.
- IO Stream classification
- The difference between close () and flush ():
Flush () is used to refresh the buffer, after the refresh or can be written again
Close () is used to shut down resources and cannot be written out after closing.
Java EE interview Summary (i)