The 100+ real interview questions in the 2020 Ali annual summary, how many can you answer correctly?

Preface

Object-oriented programming (OOP) has many appeals. For managers, it achieves a faster and cheaper development and maintenance process. For analysts and designers, the modeling process becomes simpler and can generate clear and easy-to-maintain design solutions. For programmers, the object model seems so elegant and simple. In addition, the great power of object-oriented tools and libraries make programming a more enjoyable task. Everyone can benefit from it, at least on the surface.

The ultimate goal of all programming languages ​​is to solve the problems encountered by enterprises or people in real life. Initially, our program may be as long as "11111100001". I believe that everyone will not be unfamiliar, but everyone has never typed the code like this. . Later, assembly language appeared. Assembly language was a small amount of abstraction of basic machine language (binary). Later, many "imperative" languages ​​(such as FORTRAN, BASIC, and C) appeared. These languages ​​were an abstraction of assembly language. An abstraction. These languages ​​have made great progress, but their abstract principles still require us to focus on the structure of the computer, rather than the structure of the problem to be solved. The programmer must establish a connection between the machine and the actual problem to be solved. This process requires people to pay a lot of effort, making it difficult to write the program code, and the code written is difficult to understand, and it takes a lot of money. The cost of maintenance. Pay attention to the public account : Kylin's bug change, and receive this: JavaOOP Interview Questions 108 Interview Questions [Answer Analysis] , a collection of more than 200 pages of study notes on Java core technical knowledge points.

Object-oriented programs are a good solution to this problem. Programmers can use programs to express the elements in the actual problem. We call the representation of these elements in the program "objects". We can flexibly configure the objects according to the actual problems in order to cooperate with specific problems. Compared with the previous language, this is undoubtedly a more flexible and powerful language abstraction. In short, OOP allows us to describe the problem in terms of the problem, rather than in terms of the problem in the machine solution. Compared with "objects" or "objects" in the real world, programming objects have something in common with them: they all have their own characteristics and behaviors.

JavaOOP interview questions

1. What is the B/S architecture? What is C/S architecture

  1. B/S (Browser/Server), browser/server program
  2. C/S (Client/Server), client/server, desktop application

2. What development platforms does Java have?

3. What is JDK? What is JRE?

4. What are the characteristics of the Java language

5. The difference between object-oriented and process-oriented

6. What is a data structure?

​ The way the computer saves and organizes data

7. What are the data structures of Java?

8. What is OOP?

​ Object-oriented programming

9. The relationship between class and object?

​ The class is the abstraction of the object, the object is the concrete of the class, the class is the template of the object, and the object is the instance of the class

10. There are several data types in Java

11. The naming rules of identifiers.

12. The role of the instanceof keyword

13. What is implicit conversion and what is explicit conversion

14. Can Char type be converted to int type? Can it be converted to string type, can it be converted to double type

15. What is unpacking?

16. What are the packaging classes in Java?

​ byte:Byte,short:Short,int:Integer,long:Long,float:Float,double:Double,char:Character ,boolean:Boolean

17. What content is contained in a java class?

​ Properties, methods, internal classes, construction methods, code blocks.

18. How do you solve the problem of errors in floating-point data operations?

​ Use the Bigdecimal class to perform floating-point data operations

19.What are the characteristics of object-oriented?

20. What  is the difference when access modifiers are public, private, protected, and not written (default) ?

21. Is String the most basic data type?

22. Is float f=3.4; correct?

Answer: Not correct. 3.4 is a double-precision number. Assigning a double-precision type (double) to a floating-point type (float) belongs to down-casting (also called narrowing), which will cause precision loss, so it is necessary to force type conversion float f = (float ) 3.4; Or written as float f = 3.4F;.

23. short s1 = 1; s1 = s1 + 1; is there any error? short s1 = 1; s1 += 1; is  there any error?

24, the difference between overloading and rewriting

25, the difference between equals and ==

36, the difference between ++i and i++

i++: first assignment, then calculation ++i: first calculation, then assignment

37. What is the structure of the program?

  1. 顺序结构

  2. 选择结构

  3. 循环结构

38. How many ways are there to instantiate an array?

39. Default values ​​of various data in Java

40. What are the commonly used Java packages?

41. What are the commonly used methods of the Object class?

42. Are there pointers in java?

There are pointers, but they are hidden. Developers can't directly manipulate the pointers. The pointers are manipulated by jvm

43. Is value passing by reference in java?

44. Can the length of the array be changed after the array is instantiated?

No, once the array is instantiated, its length is fixed

Pay attention to the public account : Kylin changes the bug, and understands 108 interview questions for  JavaOOP [Answer Analysis]

45. Assuming there are 5 elements in the array, what should I do if the array is reversed?

Create a new array, loop through each element from back to front, and put the extracted elements into the new array in order

46. ​​The difference between formal participation and actual parameters

47. Can the constructor be called explicitly?

48. What is method overloading?

49. Can the construction method be rewritten? Can it be overloaded?

50. What is the difference between an internal class and a static internal class?

51. What is the function of the Static keyword?

52. What are the uses of final in java?

53.  What is the difference between StringString StringBuffffer  and  StringBuilder ?

54. Is String str=”aaa” the same as String str=new String(“aaa”)?

55. What are the commonly used methods of the math class in java?

56. What are the commonly used methods of the String class?

57. Is inheritance in Java single inheritance or multiple inheritance?

There are both single inheritance and multiple inheritance in Java. For a java class, there can only be one parent class, and for an interface, multiple interfaces can be inherited at the same time

58. What do Super and this mean?

Super represents the parent class object of the current class This represents the object of the current class

59. What is the difference between a normal class and an abstract class?

Ordinary classes cannot contain abstract methods, abstract classes can contain abstract methods, abstract classes cannot be instantiated directly, ordinary classes can be instantiated directly

60. What is an interface? Why do I need an interface?

61. What are the characteristics of the interface?

The declarations in the interface are all public static final modified constants. All methods in the interface are abstract methods. The interface is an interface without a construction method and cannot be directly instantiated. The interface can be inherited.

62. What is the difference between abstract class and interface?

63, the role of Hashcode

64. Four references to Java, strong and weak

65. How many ways does Java create objects?

66. Is it possible that two unequal objects have the same hashcode?

67. What is the difference between copy and shallow copy?

68.What are the uses of static?

69. Is there any difference between a=a+b and a+=b?

70、final、finalize()、finally

71, JDBC operation steps

Load the database driver class, open the database connection, execute the sql statement processing, return the result, close the resource

72. How to prevent SQL injection problems when using jdbc.

Use PreparedStatement class instead of Statement class

73. How to call a stored procedure in JDBC

Use CallableStatement

74. Do you understand the connection pool and what are the benefits of using the connection pool?

75. What data source technologies do you know about? What are the benefits of using data sources?

76, the difference between & and &&

77. How to define static inner classes

78. What is a member inner class

79. The difference between Static Nested Class and Inner Class

80. When to use assert

81. Does Java have goto?

82. Does the array have the length() method? Does the String have the length() method?

83. Use the most efficient method to calculate how much 2 times 8 is equal to

84. Is the float type float f=3.4 correct?

Incorrect. The precision is not accurate, you should use forced type conversion, as shown below: float f=(float)3.4

85. What are the methods for sorting? Please list!

Pay attention to the public account : Kylin changes the bug, and understands 108 interview questions for  JavaOOP [Answer Analysis]

86. What is the difference between static variables and instance variables?

static i = 10; //constant class A a; ai =10;//variable

87. Name some commonly used classes, packages, and interfaces, please cite 5 each

88. What is the use of a.hashCode()? What is the relationship with a.equals(b)?

89. What are compile-time constants in Java? What are the risks of using it?

90. How to break out of the current multiple nested loops in Java?

Add a mark such as A before the outermost loop, and then use break A; you can jump out of multiple loops. (Java supports labeled break and continue statements, which are similar to goto statements in C and C++, but just like avoiding goto, you should avoid using labeled break and continue, because it won’t let you The program becomes more elegant, and in many cases it even has the opposite effect, so this kind of syntax is actually better.)

91. Can the constructor be overridden?

Constructors cannot be inherited, so they cannot be overridden, but they can be overloaded.

92. Two objects have the same value (x.equals(y) == true), but they can have different hash codes. Is this sentence correct?

93. Can the String class be inherited?

The String class is a final class and cannot be inherited. Inheriting the String itself is a wrong behavior. The best way to reuse the String type is the association relationship (Has-A) and the dependency relationship (Use-A) instead of the inheritance relationship (Is -A).

94. When an object is passed as a parameter to a method, the method can change the properties of the object and return the changed result. So, is it passed by value or by reference?

It is value pass. The method call of the Java language only supports parameter value passing. When an object instance is passed to a method as a parameter, the value of the parameter is a reference to the object. The properties of the object can be changed in the process of being called, but the change to the object reference will not affect the caller. In C++ and C#, the value of the incoming parameter can be changed by passing by reference or passing out the parameter. You can write the code shown below in C#, but you can't do it in Java.

95. What is the difference between String and StringBuilder and StringBuffer?

96. The difference between Overload and Override. Can overloaded methods be distinguished based on the return type?

97. Can a Chinese character be stored in a char variable? Why?

98. What are the similarities and differences between abstract class and interface?

99. What is the difference between Static Nested Class and Inner Class?

Static Nested Class is an internal class declared as static, which can be instantiated without relying on external class instances. The usual inner class needs to be instantiated after the outer class is instantiated, the syntax looks very strange, as shown below

100. Will there be a memory leak in Java? Please describe briefly.

101. Can abstract methods be static at the same time, can they be native methods at the same time, and can they be modified by synchronized at the same time?

102. Is it possible to call a non-static method from within a static method?

103. How to implement object cloning?

104. Can the interface extend the interface? Can abstract classes implement interfaces? Can abstract classes inherit concrete classes?

105. Can a ".java" source file contain multiple classes (not internal classes)? What are the restrictions?

106. Can Anonymous Inner Class inherit other classes? Can the interface be implemented?

107. Can an inner class refer to the members of its containing class (outer class)? Are there any restrictions?

108. What are the uses of the final keyword in Java?

The above interview questions have been sorted into PDF documents. Pay attention to the public account : Kylin fix bugs, understand  JavaOOP interview questions 108 interview questions [Answer Analysis] , and more than 200 pages of study notes on Java core technical knowledge points. The world of programming is always going All people who love programming are open. This is a free, equal and shared world. I have always believed in this way.

At last

Welcome everyone to communicate, if you like the article, remember to follow me and give me a like, thank you for your support!

Guess you like

Origin blog.csdn.net/QLCZ0809/article/details/112500572