java interview questions

1. The problem of permission control to the button.

 

2. Get the properties of the object when debugging the java code.

use reflection

3. How do js strings become dynamically executed code.

eval() 函数,eval("x=10;y=20;document.write(x*y)")

4.SQL injection attack problem.

Escape special characters.

 

5. Have you seen open source code?

 

6. Do you understand distributed deployment, springboot, etc., what are the benefits, and what are the problems encountered.

The benefits of distributed deployment are:

(1). Business splitting does not affect each other, and the failure of a certain piece of business will not affect the entire system;

(2). The load can be transferred from a single node to multiple, thereby improving efficiency.

(3). Service downgrade. When the overall load of the service exceeds the preset upper limit threshold, in order to ensure the normal operation of important or basic services, we can delay or suspend some unimportant or non-urgent services or tasks. use.

 

Problems encountered:

(1). The problem of transaction rollback, such as between the order and the commodity, the order is cancelled, the commodity service is hung up and the rollback is not successful, and the number of commodities is not increased. You can use the compensation mechanism to store in the database, and then regularly notify the goods and services and determine whether the processing is successful. Or put it in the message queue, and get the information to modify after the goods and services are restored.

7. Count all java files under a certain path, and count the number of codes  .

http://z1414644039.iteye.com/blog/2421925

 

8. The underlying implementation principle of hashMap

HashMap is a combination of an array and a linked list. The storage location is calculated according to the hash value of the key. The non-conflict is stored in the array, and the conflict is stored in the linked list.

http://tracylihui.github.io/2015/07/01/Java Collection Learning 1: The Implementation Principle of HashMap/

 

9. The implementation of multi-threading
inherits the Thread class, implements the Runnable interface, and uses ExecutorService, Callable, and Future to realize multi-threading with returned results.

 

10. Several states and switching of threads

https://blog.csdn.net/pange1991/article/details/53860651

 

11.jdk source code

https://blog.csdn.net/singit/article/details/54821159

 

12.类加载顺序

https://blog.csdn.net/hellorichen/article/details/53007716

 

13.http和https的区别

http是HTTP协议运行在TCP之上。所有传输的内容都是明文,客户端和服务器端都无法验证对方的身份。

https是HTTP运行在SSL/TLS之上,SSL/TLS运行在TCP之上。所有传输的内容都经过加密,加密采用对称加密,但对称加密的密钥用服务器方的证书进行了非对称加密。此外客户端可以验证服务器端的身份,如果配置了客户端验证,服务器方也可以验证客户端的身份。

14.session和cookie的区别

https://www.zhihu.com/question/19786827 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326010049&siteId=291194637