2020, the latest version of Java interview questions Daquan (end text attached Answers)

Foreword


This set of Java interview questions Daquan divided into a total of ten three modules:

  1. Java basic knowledge questions

  2. Java exception interview questions

  3. JVM face questions

  4. Spring face questions

  5. Spring MVC face questions

  6. Spring Boot face questions

  7. Spring Cloud face questions

  8. MyBatis face questions

  9. Redis face questions

  10. Dubbo face questions

  11. Tomcat face questions

  12. ZooKeeper face questions

  13. Netty face questions

A, Java basic knowledge questions

1, Java Overview

  • What is programming?

  • What is Java?

  • Three versions after jdk1.5?

  • JVM, JRE and JDK relationship?

  • What is cross-platform? What is the principle?

  • What are the characteristics of the Java language have?

  • What is bytecode? What is the biggest benefit of using bytecode is?

  • What is the main class Java program? The main class of applications and applets What's the difference?

  • What are the differences between Java applications and applets?

  • The difference between Java and C ++?

  • Comparison of OpenJDK and Oracle JDK?

2, basic grammar

①. Data Types

  • What Java data types

  • Whether the switch can act on byte, whether acting on the long, whether the role of String

  • 2 is calculated by multiplying 8 the most efficient method for

  • Math.round (11.5) is equal to how much? Math.round (-11.5) equal to the number of

  • float f = 3.4; correct

  • short s1 = 1; s1 = s1 + 1; wrong it short s1 = 1;? s1 + = 1; Always Wrong

②. Coding

  • Java language coding scheme which uses? What are the characteristics?

③. Notes

  • What Java annotations

④. Access modifier

  • Access modifiers public, private, protected, and when the difference is not write (default)

⑤. Operators

  • & & & Distinction of

⑥. Keyword

  • Java has no goto

  • final What's the use?

  • final finally finalize the difference

  • Use this keyword

  • Use super keyword

  • The difference between this and super

  • The main significance of the presence of static

  • static is unique

  • static scenarios

  • static precautions

⑦. Flow control statements

  • break, continue, return difference and effect

  • In Java, how to jump out of the current multi-nested loop

3, object-oriented

①. Object-oriented overview

  • Object-oriented and process-oriented difference

②. Three characteristics of object-oriented

  • Object-oriented features have what

  • What is a multi-state mechanism? Java language is how to achieve polymorphism?

  • What are the five basic principles of object-oriented is the (optional)

③. Class and Interface

  • Comparison of abstract classes and interfaces

  • General classes and abstract classes What are the differences?

  • Abstract classes can use the final modified it?

  • Create an object with what keywords? Object instances and object references What's the difference?

④. Variables and methods

  • Member variables and local variables What difference

  • A Java does not work and is not defined in the constructor parameters of the role

  • Before calling the constructor of a subclass will first call the parent class has no constructor parameters, its purpose is?

  • What is the role of a class constructor is? If the class does not declare a constructor, the reform process can be performed correctly? why?

  • Constructors What are the characteristics?

  • The difference between static and instance variables

  • Static variables with common variable difference

  • Static and instance methods What is the difference?

  • Call a non-static member within a static method Why is it illegal?

  • What is the return value of the method? What is the role of the return value?

⑤. Inner classes

  • What is the inner class?

  • What kind of internal classification

  • Advantage inner class

  • What inner class scenarios

  • When a local inner classes and anonymous inner class to access local variables, variables Why must add final?

  • Internal or related, to see the results of running the program say

⑥. Rewritten and overloading

  • If the constructor (constructor) can be rewritten (the override)

  • The difference between overloading (Overload) and rewritable (Override) is. Overloaded method can be differentiated according to the type of return?

⑦. Analyzing objects are equal

  • What is the difference between == and the equals

  • hashCode and equals (important)

  • Equal to their reference point is equal to the object, both what is the difference?

⑧. Value transfer

  • When an object is passed as a parameter to a method, this method can change the properties of this object, and returns the result of the change, in the end, this is passed by value or by reference transmission

  • Why only passed by value in Java

  • Value is passed and passed by reference any difference

⑨. Java package

  • JDK packages commonly used in what

  • import java and javax What is the difference

4, IO flow

  • java in IO stream is divided into several?

  • BIO, NIO, AIO What is the difference?

  • What are the common methods Files?

5, the reflection

  • What is reflection?

  • Advantages and disadvantages of reflection

  • Scenarios reflection of what?

  • Three ways to get Java reflection

6, network programming

7, common API

①. String relevant

  • The difference between character constants and string constants

  • What is a string constant pool?

  • String is the most basic type of data it

  • What are the characteristics of String

  • Why String is immutable it?

  • String is immutable really do?

  • You can inherit String class

  • String str = "i" and the String str = new String ( "i") the same?

  • String s = new String ( "xyz"); String object created several

  • How to reverse a string?

  • Array has no length () method? String has no length () method

  • Common methods of the String class are those?

  • When using the HashMap, to do with String key What are the benefits?

  • What is the difference between String and StringBuffer, StringBuilder is? Why String is immutable

②. Date related

③. Related packaging

  • Automatic boxing and unboxing

  • What is the difference int and Integer

  • Integer a = 127 and it is equal to Integer b = 127

8, common tools library

9, the test unit

10, the log

Two, Java abnormal face questions

1. What is the difference between Error and Exception?

2, run-time exceptions and general exceptions (Unchecked exceptions) What is the difference?

3, JVM is how to handle the exception?

4. What is the difference between throw and throws?

5, final, finally, finalize what is the difference?

6, NoClassDefFoundError and ClassNotFoundException difference?

7, try-catch-finally in which part can be omitted?

8, try-catch-finally, if in return the catch, finally will be implemented?

9, class ExampleA inherit Exception, class ExampleB inherit ExampleA?

10, common RuntimeException What?

11, Java common exceptions What?

Three, JVM face questions

1, Java memory area

  • Talk about the main components of the JVM and its role?

  • Talk about the JVM run-time data area?

  • Deep copy and shallow copy?

  • Talk about the difference between the stack?

  • What queue and stack is the? What's the difference?

2, HotSpot virtual machine object Quest

  • Creating objects

  • Allocate memory for the object

  • Concurrency security issues

  • Access the location of the object

3, memory overflow exception

  • Java will be a memory leak it? Please describe

4, the garbage collector

  • Description of Java garbage collection

  • GC is the What? Why GC

  • Garbage collection advantages and principles. And consider two kinds of recovery mechanisms

  • What is the basic principle is that the garbage collector? The garbage collector can immediately reclaim memory? Is there any way the initiative to inform the virtual machine garbage collection?

  • What are reference types in Java?

  • How to determine whether an object can be recycled?

  • In Java, when an object can be recycled garbage

  • The JVM permanent generation garbage collection occurs it

  • What to say about the JVM garbage collection algorithm have?

  • What to say about the JVM garbage collector?

  • Details about the CMS garbage collector?

  • The new generation and the old garbage collector's garbage collector has what? What's the difference?

  • Brief generational garbage collector is how to work?

5, memory allocation strategy

①. DESCRIPTION java memory allocation and recovery rates and policies Minor GC and Major GC

  • Objects priority allocation in Eden District

  • Large objects directly into the old year

  • Long-term survival of the object will enter the old year

6, VM class loading mechanism

  • Description of java class loading mechanism?

  • Describe the principle mechanism JVM loaded Class file

  • What is the class loader class loader What?

  • Talk about the implementation process of class loading?

  • What is a parent delegation model?

7, JVM tuning

  • Talk about JVM tuning tool?

  • JVM tuning commonly used parameters have what?


Due to space reasons only here to show you the first three modules, and the rest of the ten modules will not bore you show Ha ~

We focus on micro-channel public Fanger Wei code number of the next scan directly: the Java Head

Then replies: face questions

You can get a full free full version Daquan Java interview questions and suggested answers! ! !

Published 126 original articles · won praise 4184 · Views 2.61 million +

Guess you like

Origin blog.csdn.net/singwhatiwanna/article/details/104765374