1. Abstraction, inheritance, encapsulation, polymorphism
2. Number of bytes for the base data type
Byte:1, Int:4, Char:2, Long:8, Float:4, Double:8, Boolean:1 and Short:2
3.String, the difference between stringbuffer,stringbuilder
When strings are less spliced, use string
When strings are frequently stitched together, StringBuilder should be used in a single-threaded environment to ensure good performance and should be used when multithreading security is required StringBuffer
4.servlet life cycle, the difference from CGI
Instantiate, Init (), service method, Doget or Dopost method, call Destroy () destroy
Servlet One instance serves multiple requests, CGI a request to open a process, the service is completed to destroy
The difference between dynamic include and static include in 5.JSP
The 6.round method returns the longest integer closest to the parameter, and the parameter adds 1/2 to its floor.
7. Can the constructor constructor be override?
8.iterator
Iterator<string> it = Books.iterator ();//This form of traversal can be removed with it.remove (), and none of the other methods can throw an exception. while (It.hasnext ()) { System.out.println (It.next ());}
9. Collection Security
sortedset<string> s = collections.synchronizedsortedset (new treeset<> ());
The difference between 10.Runnable and Thread
The Runnable object is only used as the thread executor only as the run () method contained in the Target,runnable implementation class of the thread object. and the actual thread object is still a thread instance,
Only the thread thread is responsible for executing its target's run () method.
11.join () Use method, start first (), and then join ();
public static void Main (string[] args) throws exception{for (int i=0;i<100;i++) { if (i==20) { Jointhread JT = new Jointhread ("join"); Jt.start (); Jt.join (); } System.out.println (Thread.CurrentThread (). GetName () + "---" +i); } }
12. Background Threads
Run in the background, servicing other threads, such as GCC, and calling the thread's Setdaemon (True) method to set it as a background thread.
If all foreground threads of a process die, the JVM notifies the process of the background thread to cause it to die.
You need to call Setdaemon (true) before start (), otherwise an exception will be thrown.
13. Change the priority of a thread
The thread class provides setpriority (int newpriority) and getpriority () to set
and returns the priority of the specified thread. 10 max, 1 min, 5 normal
14.synchronized
The essence of synchronized is Object lock, when locking method, this is locked by default, and when an object is locked, other locked code blocks with the same object lock cannot be called.
The difference between 15.wait () and sleep ()
Wait () releases the synchronization monitor, and sleep () and yield () do not release the synchronization monitor
Java face question (excerpt)