各种面试问题汇总

1.JAVA变量什么时候需要初始化?

像memo[][]这样的 类的成员变量不需要,因为JVM会自动给其赋值;

像类里面的变量是一定要初始化的;


2.encapsulate封装的概念;


3.concurrent collection interfaces provided

BlockingQueue

ConcurrentMap

ConcurrentNavigableMap


4.Apache dubbo是基于什么传输的?


5.整个Spring的工作原理?


6.JAVA8的各个集合的使用?


7.你使用过的微服务以及@Component?


8. 关于抽象方法正确的是?

abstract是需要被继承使用的,所以它不能被final使用,所以A错,也可以有private属性,B错,也可以有普通方法 甚至所有都可以是普通方法,当然这样也就失去了abstract类的意义,C错,interface属于特殊的abstract类,也是abstract类,所以D对


9.怎么讲清楚Spring和Spring Boot的原理?


10.Microservices的缺点有哪些?

1)架构复杂;2)多服务运维难度;3)系统部署依赖;4)服务间通信成本;5)数据一致性;6)系统集成测试;7)重复工作;8)性能监控;

正常情况下,需要从成本、复杂度、测试、监控等方面出发;


11.什么是OOP?

Mira Tan Yay!!!!!!!!!! And Xin Tan Yay!!!!!!!!!!

on the concept of classes and objects, a class is abstract and used to create more specific objects, and also classes contain functions, called methods available only to that specific type of object.

class templates are used as blueprint to create individual objects.

Secure, protects information through encapsulation

classes are essentially user defined data types

Objects are instances of classes created with specific data

Attributes are defined in the Class template

Methods represent behaviors. Methods perform actions; 

Four Principles of OOP: Inheritance, Encapsulation, Abstraction, Polymorphism

Inheritance supports reusability

Encapsulation means containing all important information inside an object, and only exposing selected information to the outside world.

Abstraction means that the user interacts with only selected attributes and methods of an object. Abstraction uses simplified, high level tools, to access a complex object.

Polymorphism means designing objects to share behaviors

Method Overloading:Compile Time polymorphism

Method Overriding:Runtime polymorphism,运行的时候才知道

Looking at how to break up the requirements into simple, reusable classes that can be used to blueprint instances of objects. Overall, implementing OOP allows for better data structures and reusability, saving time in the long run.


12.什么是Spring?

Spring understand the different annotations added by developer on the top of classes, create an instance of the class and Spring manage it.


13.说一下 HashMap 的实现原理?


14.集合fail fast原理

15.实现一个MaxStack

16.interface可以有static methods吗

可以有,还可以有default方法;

interface里的方法都必须是final abstract

JAVA8前接口的方法都必须是abstract的,因为是抽象的,所以要实现,而且只能是public的,想想为什么?

接口中的变量是常量,即public static final

JAVA8之后可以有非abstract的default方法(不能用类直接调用,可以override),而且可以有static的方法(可以用类直接调用)


17. 解释下Java Interceptor Controller和Servlet

18. thread wait for 1 sec有什么方法?

19. JAVA String和JAVA Collection有什么区别?

20. 用SQL实现一个join语句,包括left join和right join.

21. HashMap和TreeMap的区别?一个有序一个无序


21. 什么是泛型?

泛型是一种约束,一种规则,是一种安全机制;非常常见的ArrayList类就是一个泛型类;不知道使用什么类型来接收的时候,此时可以使用?,?表示未知通配符;https://www.zhihu.com/question/272185241

就好比作文题材不限,但一次只能写一种题材,至于是什么题材,由我们自己定。



22. Web API和JAVA API的区别

Web API,一般指基于http的编程接口,接口一般定义HTTP的:请求方法、请求路径、参数、响应数据格式、响应http code等。至于http server,可以用Java、.Net、nodejs等各种框架实现,http server属于Web API的实现;

API(Application Programming Interface),指应用程序编程接口,可以看看这些API你就会用了,而不用知道里面的详细细节;


23. Object的equals方法和String的equals方法是不同的

如果没有单独的equals方法,得继承Object的equals方法;

equals默认是比较地址值的,比较地址值是没有意义的;

==如果基本类型是比较值,引用类型是比较地址;


24. 抽象类可以不包含抽象方法,但如果中包含抽象方法,就必须将该声明为抽象类

25. 数据库的几大键, Foreign Key

26. B-tree, transient关键字

27. db的index怎么发生的;

28. Application, Request, Session, Page

29. 子类中可以new一个父类吗?

30. 反射

31.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容