[Reprint] java basis of interview / document questions Finishing (c)

java-based interview / document questions Finishing (c)

https://www.jianshu.com/p/cf789143e81d

 

  1. Isolation level data is implemented by the database system is a database system itself. When we write java program just set transaction isolation level, rather than to achieve it.
    (I marked this focus, because it is really asked a lot of times. Of course, the isolation level of the transaction should be. Can not understand the point of the link went to see the transaction isolation level and the four characteristics of the database )
  2. ThreadLocal is the class. ThreadLocal class declared as public <T>
    ThreadLocal class for each thread maintains its own unique variable copy. Each thread has its own independent variable.
    ThreadLocal way is to use a hash table to provide a copy of a variable for each thread.
    ThreadLocal ensure data security between threads, each thread data will not be another thread to access and destruction.
  3. When there is no no-argument constructor in the parent class constructor calls the parent class's subclasses to be displayed in its own constructor.
  4. Formal parameters can be treated as a local variable (local variable).
    When the form is transmitted parameters is called a copy of the actual parameter.
  5. int i = 0; i = i ++; system.out.print (i); the result is 0;
    as i = i ++; i ++ is then used to calculate, so that i = 0;
  6. static methods can not be overridden by classes.
    The Father.staticMethod (); or F = new new Son Father (); f.staticMethod ();
    static method call statements are the two parent class.
  7. try-catch-finally:
  • Whether or not an exception, finally block of code will be executed.
  • try or catch return there when, finally will be executed.
  • finally it is (value after the operation at this time did not return, but first saved, if finally there is no return, the values ​​are retained regardless of return) to execute after the operation expression after return. Therefore, the function return value is finally determined before execution.
  • finally there is return, the program will quit ahead of the return is finally in return rather than try or catch in return.
  1. simpleDateFormat is thread safe.
  2. java command line: "java Test one two three" .
    Test method is invoked, one two three parameters is the main function.
  3. ASCⅡ code contains some special null character, unprintable.
  4. End of the stream is a stream of bytes, reader and writer ending characters are.
  • Static inner classes before they can declare a static method.
  • Static methods can not use non-static variables
  • Abstract methods can not have a function body
  1. In java "=" is assigned, "==" is an equality.
  2. The reason may have spilled the old generation: string processing cycle thousands of times. Create tens of millions of objects. Application over a period of hundreds of M code or G on the memory.
    Permanent generation overflow reason: a large number of dynamic loading java class and cause an overflow.
  3. DriverManager.getConnection method returns a Connection object, which is carried out after loading the driver before.
  4. Subclasses can override a synchronization method of the parent class (the synchronized modified).
  5. java language, non-static methods are members of objects, static methods are members of the class.
  6. java reflection mechanism mainly provides the following functions:
  • Analyzing the object belongs to a class of any runtime.
  • At runtime class of an object in any configuration.
  • Analyzing any class has member variables and methods at runtime.
  • Call any of the object's methods at runtime, generate dynamic proxy.
  1. Examples of methods can be called directly to this class of class methods (though rarely so used, but no syntax errors, there are yellow warning).
  2. When the method is called, it would create a stack frame on the stack when the call is completed automatically pop release.
  3. Packaging and Math classes are not inherited class.
  4. The two classes jvm Analyzing the same: 1) the full name of the class. 2) class loader.
  5. A java source file defines several interfaces and classes, then the compiler generates bytecode few .class files. Including its own .class file interfaces and inner classes.
  6. RMI (Remote Method Invocation) Remote Method Invocation is the use of remote objects call each other between a computer implement a communications mechanism for communication between the parties. Java is a convenient way to build distributed applications. Default using TCP / IP protocol.
  7. Two basic garbage collection algorithm in java: replication algorithm, labeled cleaning algorithm.
  • Replication algorithm: two regions A, B. Initial object continue to live transferred to B when A, garbage collection, this new generation is the most commonly used algorithms.
  • Labeled cleaning algorithm (also called mark some clear algorithm): an area up to mark objects by reachability analysis. Then recovered unreachable objects. Because there will be space debris, which leads to
  • Tags to organize algorithm: more defragmentation, clean out the larger memory.
  1. jdk provide synchronization for concurrent programming: Semaphore, CyclicBarrier, CountDownLatch.
  2. socket programming, operating the service side (I think this format is good-looking, there really is not an orderly orderly sets):

① server initialization socket.
② and port binding (blind ()).
③ create serverSocket listening (listent ()).
④ call blocking (accept ()) to wait for client connections.
⑤ read and write operations (read (), write () ) after the connection.
⑥ last call close () closes the connection.

  1. Math.round (11.5); 12 value. Math.round (-11.5); value of -11.
    This method takes the nearest integer, if the upper and lower click, whichever is greater.
  2. The pipeline read and write operations are likely to be blocked.
    If the pipeline is empty, then the read operation is blocked. The pipeline is full, the write operation is blocked.
  3. final three kinds of modified member variable assignment mode:
  • Direct assignment in the statement.
  • Assignment in the constructor.
  • In the initial assignment block.

Well, today has to end here. Strive to learn a little bit every day, do not know how long qualitative change, ha ha. Then we encourage each other, I wish you all work life smoothly it!
Full hand to play is not easy, if you feel you have to help a little or use, do not mean like a point and a point of concern Oh ~ ~

Guess you like

Origin www.cnblogs.com/jinanxiaolaohu/p/12162801.html