当前位置:网站首页>Shenzhen mintai'an intelligent second side_ The first offer of autumn recruitment

Shenzhen mintai'an intelligent second side_ The first offer of autumn recruitment

2022-06-25 13:15:00 Wanghuiju

2020/9 Of the moon . At present, we have received the intention of the company offer.  This interview covers a wide range , But it's more basic , School recruitment , It is about the coverage of knowledge system .

java Basics  
1 == equals difference   

== When comparing basic data types , Comparison is worth . When comparing reference types , The comparison is the address value

equals situation 1: Class does not cover  equals() Method . Through equals() When comparing two objects of this class , It's equivalent to passing “==” Compare the two objects . The default used is  Object class equals() Method .

            situation 2: Class covers  equals() Method . commonly , We all cover  equals() Method the contents of two objects are equal ; If their contents are equal , Then return to true( namely , Think these two objects are equal ).


2:string Can we inherit   And buffer builder The difference between

string By final Embellishments cannot inherit .   buffer It's thread safe ,builder Is thread unsafe but more efficient


3  hashcode And equals The difference between

hashCode()  To get hash code , Also known as hash code ; It actually returns a int Integers , Can be repeated , But there will be problems . such as set aggregate , Elements are stored according to hashcode To calculate whether an element exists , If repeated, it will conflict

rewrite  equals  Must rewrite  hashCode  Method

If two objects are equal , be hashcode It must be the same . Two objects are equal , Call... On two objects separately equals Methods all return true. however , Two objects have the same hashcode value , And they don't have to be equal . therefore ,equals Methods are covered , be  hashCode  Method must also be overridden .


4   Basic data type

byte short long double float int char boolean

5  String s=new String("w")   Create several objects

One or two objects , Check whether there is in the constant pool  "w" This object

 

6  collection and collections The difference between

collection Interface contains list,set aggregate .  collections Is a utility class , Provide encapsulated methods for collections


7  set and list Implementation classes and differences

  • HashSet( disorder , only ): be based on  HashMap  Realized , The underlying the  HashMap  To save elements
  • LinkedHashSetLinkedHashSet  yes  HashSet  Subclasses of , And inside it is through  LinkedHashMap  To achieve .
  • TreeSet( Orderly , only ): Red and black trees ( Self balanced ordered binary tree )
  • Arraylist: Object[] Array
  • VectorObject[] Array
  • LinkedList: Double linked list (JDK1.6 It was a circular list ,JDK1.7 The loop was canceled )

The difference between them . The content is more , Suggest systematic learning . This topic is omitted


8  >>  & && What these operators do

&  Both are “1”, The result is “1”, Otherwise 0

|  Only one of the two objects involved in the operation is 1, Its value is 1.

^ Exclusive or operator   Operational rules :0^0=0;  0^1=1;  1^0=1;   1^1=0;  Same as 0 Different for 1

~ Negation operator    Operational rules :~1=0;  ~0=1;    namely : Bitwise negate a binary number , the 0 change 1,1 change 0.

Shift left operator (<<) Move left 1 Behind you a = a *2; 

Shift right operator (>>) Move the operands one bit to the right , It's the number divided by 2.

Shift right operator (>>>) Shift right without sign

 

9  java In the lock


10   Optimistic lock and pessimistic lock

I have written articles about optimistic locks and pessimistic locks   https://blog.csdn.net/wang5701071/article/details/108488834


11   What are the thread pools ?  

What I know about thread pools is ThreadPoolExecutor. Other thread pools are also implemented based on this thread pool .


12   Several ways to implement threads

Inherit Thread Realization runnable Interface Realization callable Interface


13   What data structures are used at the bottom of the thread pool

What the interviewer should want to ask is the knowledge about the queue , But I didn't figure it out on the spot .


14  java8 And how to use it

lambda expression ,stream flow These are important

lambda Functional programming , A lot of code is reduced , You can write parameters directly without writing anonymous inner classes . Parameter modifiers can be omitted .

Stream flow There are two types of operation: intermediate operation and final operation , The final operation returns a specific type of calculation result , And the middle operation returns Stream In itself .List perhaps Set Support , Map I won't support it


15  jvm The partition

Program counter , Heap area , Method area , Native Method Stack , Virtual machine stack


16  GC How to implement

Reference counting , Reachability algorithm . These two kinds of


17  jvm Parameter tuning for

  1. in the light of JVM Heap settings , In general, you can go through -Xms -Xmx Limit it to a minimum 、 Maximum , In order to prevent the garbage collector at the minimum 、 The maximum amount of time required to shrink the pile , Usually put the biggest 、 The minimum setting is the same ;
  2. The younger generation and the older generation will be based on the default ratio (1:2) Allocate heap memory , You can adjust the ratio between them NewRadio To adjust the size between the two , It can also be used for recycling . For example, the younger generation , adopt -XX:newSize -XX:MaxNewSize To set its absolute size . Again , To prevent the young generation from shrinking , We usually put -XX:newSize -XX:MaxNewSize Set to the same size .


18  java The queue in

Queue: Basically , A queue is a first in, first out (FIFO) Data structure of

Queue Interface and List、Set Same level , It's all inherited Collection Interface .LinkedList Realized Deque Pick up mouth .


19  juc What's next

Atomic classes of reference types . Concurrent collections , locks , aqs. 


20   The difference between overloading and rewriting

Overloading occurs in the same class . Different parameter list , Same method name . And return value , Access rights are irrelevant

Overrides happen in parent-child classes . Method name , Same parameter list . The access permission is greater than or equal to the parent class . The return value is less than the parent class


21   Several states of threads ,start What happens when the method runs .

newly build , be ready , function , Blocking . Death


22   Singleton design pattern , Factory design mode spring Design patterns in

spring Applied to the singleton mode , Factory mode . The strategy pattern . The proxy pattern


23   Abnormal and error The difference between

Exceptions can be caught and continue to run ,error Can not continue to run after the occurrence


24  try When returning a value ,finaly Will it execute

Meeting


25  finaly It is not recommended to write return?

Not recommended .finaly It is used for final processing


26   introduce aqs

If the requested shared resource is free , Set the thread of the current request resource to a valid worker thread , And set the shared resources to the locked state . If the requested shared resource is occupied , Then we need a set of mechanism for thread blocking waiting and lock allocation when it is awakened , This mechanism AQS Yes, it is CLH The implementation of queue lock , Join the queue with the thread temporarily unable to acquire the lock .


27  Sync Principle

Monitor It's a thread private data structure , There is also a global list available . Every locked object will be associated with a monitor relation , Indicates that the lock is occupied by this thread .

 


javaWEB
0  jsp Built in objects for

Basically not jsp 了 A little


1   How to implement the filter

  1. establish Filter class

    2. stay web.xml Configuration in file Filter


2  request Several ways to , And their role

Getting client information

  getRequestURL Method returns the client's complete request URL.
  getRequestURI Method returns the resource name part of the request line .
  getQueryString Method returns the parameter part of the request line .
  getPathInfo Method returns the request URL Additional path information in . The extra path information is the request URL Located in Servlet After the path and before the query parameters , It uses “/” start .
  getRemoteAddr Method returns the... Of the requesting client IP Address .
  getRemoteHost Method to return the full hostname of the requesting client .
  getRemotePort Method returns the network port number used by the client .
  getLocalAddr Method returns WEB Server's IP Address .
  getLocalName Method returns WEB The hostname of the server .

Get the client request header

  getHeader(string name) Method :String 
  getHeaders(String name) Method :Enumeration 
  getHeaderNames() Method

Get client request parameters ( Data submitted by the client )

  • getParameter(String) Method ( Commonly used )
  • getParameterValues(String name) Method ( Commonly used )
  • getParameterNames() Method ( Not commonly used )
  • getParameterMap() Method ( When writing a framework, you often use )


3   If you log in sessionid stay cookie Stored in and normal cookie What's the difference?

I do not know! , There is an old brother who knows to help answer .


4  spring How to get context

adopt ClassPathXmlApplicationContext Class gets . How to use it is as follows :

ApplicationContext ap = new ClassPathXmlApplicationContext("applicationContext.xml");


5  spring How to implement method interception in , Specific steps

Use aop


6  spring Scope of action , And a single column , How to implement multi column objects

  • singleton : only bean example ,Spring Medium bean By default, it's single .
  • prototype : Each request creates a new bean example .
  • request : every time HTTP Requests all produce a new bean, The bean At present only HTTP request Effective within .
  • session : every time HTTP Requests all produce a new bean, The bean At present only HTTP session Effective within .
  • global-session: overall situation session Scope ,


7  mybatis Of $ # difference

A precompiled , One is not precompiled


8  mybatis Of resultmap and resulttype The difference between

resultType: When using resultType do SQL Statement return result type processing , about SQL The fields queried by the statement are in the corresponding pojo There must be the same field corresponding to it in , and resultType It's about pojo Position in this project .

resultMap: When using resultMap do SQL Statement return result type processing , It is usually necessary to mapper.xml In the definition of resultMap Conduct pojo Corresponding to the corresponding table field .


9  mybatis Of mapper Method If dao What happens if the layer has no corresponding interface

Report errors ,mybatis It is implemented by dynamic proxy , If the interface is not found, an error will be reported

 

database
1  sql Execution order of keywords

from  where group by  select order by  limit

 


2   The function of finding the average , And the average of the whole class sql

group by+avg


3  like keyword , How to ensure that the index is used  

Fuzzy matching to last

 

The following is an outline of personal play

Programming questions
Recursive output file path
Binary search

What do you expect from the company ;
What is your own development plan
Do you have anything to ask me ? 

原网站

版权声明
本文为[Wanghuiju]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206251216304703.html