Cattle off network do problems 5.27

(1) Java format is not +++ j

(2) This question is to demonstrate the return and finally the order of statements, detailed look at the following code and parse

public abstract class Test {

    public static void main(String[] args) {

        System.out.println(beforeFinally());

    }

     

    public static int beforeFinally(){

        int a = 0;

        try{

            a = 1;

            return a;

        }finally{

            a = 2;

        }

    }

}

/**output:

1

*/

From the results point of view, it looks like `finally` in the statement is executed after` return`, it is not true, in fact, `finally` in the statement is executed before` return`. So the question is, since it is executed before, why the value of `a` is not covered?
The actual process is as follows: When the program execution to try {} return method in the statement, it will do such a thing, will return results to a temporary storage stack, and the program does not return immediately, but to perform finally {} in the program,  when executed `a = 2`, program only the value of a cover, but does not update the value to be returned to the temporary stack  . After execution, the main program will notify "finally the program is finished, the request may be returned to" this time, they will be taken out of the return value of the temporary stack. This time should be clear, the value to be returned is saved to a temporary stack.

Look at an example, slightly changed under the above procedure:

public abstract class Test {

    public static void main(String[] args) {

        System.out.println(beforeFinally());

    }

     

    public static int beforeFinally(){

        int a = 0;

        try{

            a = 1;

            return a;

        }finally{

            a = 2;

            return a;

        }

    }

}

/**output:

2

*/

Here, finally {} also has a return, then the implementation of this return, it will update the value of the temporary stack. Also, after performing finally, it will notify the main program request returns, the value is about to take out a temporary stack of return. Therefore, the return value is 2.

(3) subclasses override the parent class method, access method can not be less than the original access to the interface, the default method is a public authority, so the public can only be overridden by subclasses

(4)

1, sub-class constructor call the parent class constructor with super

2, after the subclass overrides the superclass method, if you want to call the parent class are rewritten with super

3, the method is not overridden can be called directly.

(5)

ava object default basic method does not copy (), comprising the following method:
getClass (), the hashCode (), the equals (), clone (), toString (), Notify (), notifyAll (), the wait (), Finalize ( )

(6)

Web service definition is a web-based service, it is a cross-platform, cross-language service.

We can understand it, for example, we can call the query weather information on the Internet web service, embed it in our B / S program, when users see weather information from our network, we will consider his offer many of the service, but in fact we did not do anything, simply call one end of a bit of code on the server only. Web service can be published to your service on the Internet for others to call, you can also call others published web service, and use your own code the same.

It is the use of XML data transmission format, which is a communication protocol SOAP (Simple Object Access Protocol).

(7)

For the thread-local storage TLS (thread local storage) understanding

The same global variables or static variables for each thread access to the same variables, multiple threads can lead to memory access conflicts when the same global variables or static variables, especially when multiple threads at the same time need to change this variable by TLS mechanism, each use of the global variable thread provided a copy of the value of a variable, each thread can be changed independently own copy, but will not copy other threads of the conflict.

(8) class member variables can be used in this instance method to call, but can not use this to call in a static method

(9) inner class appreciated

(10) jre determines whether to execute the standard program is ended

所有的前台线程执行完毕

Resolution:

 main () function that is the main function, is a foreground thread, foreground process is the program must be performed to complete, while the background thread is after the end of java in the end all foreground, whether or not complete, the background thread mainly with respect to the memory allocation .                                                                                           
Foreground and background thread threads differences and connections:

1, stop the background thread does not terminate the process. After all foreground threads belonging to the process are terminated, the process will be terminated. All the rest of the background thread will stop and will not be completed.
2, foreground thread can be modified to a background thread at any time, it is to set Thread.IsBackground property.
3, regardless of background or foreground thread thread, if there is an exception in the thread, will result in the termination process.

4, the managed thread pool threads are background threads, created using the new Thread way threads are the default foreground thread.
Description:   

        The main thread and thread using the Thread constructor applications default to the foreground thread                       
    using thread Thread created by default foreground threads in the process, as long as there is a foreground thread does not exit, the process will not be terminated. The main thread is a foreground thread. The background thread regardless of whether the end of the thread, as long as all of the foreground thread exits (including normal and abnormal exit exit), the process will automatically terminate. General background thread for task processing time is short, such as in a Web server can use background threads to handle requests from clients over the information. The general procedure for foreground thread task processing takes a long time to wait, in programs such as Web servers listen for client requests, or the timing of certain system resources to scan

(11)
 

DBMS: DBMS (Database Management System) is a large-scale software for manipulating and managing a database, used to create, use and maintenance of the database, referred to as DBMS.
DBMS to achieve the protection of databases by four aspects:

  1. Database recovery
  2. Database Concurrency Control
  3. Integrity Control database
  4. Database Security Control

DBMS subsystem for persistence in affairs that recovery management subsystem.

 

 

 

 

Guess you like

Origin blog.csdn.net/weixin_41673515/article/details/90601236