Java Interview Problem collection (2)

Source: Internet
Author: User

1 integer int equality problem when an integer object compares with an int, there will be a unboxing process, always equal to the integer and new integer objects are not equal, referencing different two integer object comparisons, Integer ii=3, Equivalent to the Integer ii=integer.valueof (3), the value is retrieved from the cache from the 128-127 reference, the other new, so the objects within the interval are equal, the values are equal integer.equals is the comparison intvalue () String.Equals is also the same as comparing the contents of the StringBuffer class without redefining the Equals method, so this method comes from the object class, and the Equals method in the object class is used to compare the "address" of the &NBSP;2 How does HashMap work http://www.importnew.com/7099.htmlhttp://blog.csdn.net/hpc19950723/article/details/64920214? Locationnum=8&fps=1 load factor 0.75, automatic resize reference selection constant as the key value, which is also the reason for selecting string data stored in the entry[] custom array, entry realized the list function, that is, the bucket (key , Value,next (key,value))   3  vector  and arraylisthttp://blog.csdn.net/qq924862077/article/ Details/48039567vector thread-Safe, the others are like the ArrayList.   4  Java Collection iterator fail-fast mechanism http://blog.csdn.net/ u014558484/article/details/52221458http://www.cnblogs.com/shamo89/p/6685216.htmlhttp://blog.csdn.net/ Tkd03072010/article/details/6759234 arraylist and copyonwritearraylist  HashMap and Concurrenthashmapitorator traversal additions and deletions, the former are fail-fast, there is a change in the element when triggered, because the latter IteratorRe-implemented, not checkforcomodification  5 threadlocalhttp://blog.csdn.net/lufeng20/article/details/. 24314381 The secret of thread isolation lies in the Threadlocalmap class. Threadlocalmap is a static inner class of the Threadlocal class that has a separate threadlocalmap copy in each thread that stores values that can only be read and modified by the current thread  6 What handlermapping put in http://www.cnblogs.com/dragonfei/p/6148625.html 7 transaction nesting  8 mybatis principle  http:// blog.csdn.net/luanlouis/article/details/37671851      connection pooling      When we need to create the Sqlsession object and need to execute the SQL statement, MyBatis will call the DataSource object to create the Java.sql.Connection object       mybatis divides the pooledconnection in the connection pool into two states: idle State (idle) and active (active), and the Pooledconnection objects of the two states are stored in the Poolstate container respectively.idleconnectionsAndactiveconnectionsThe pooledconenction implements the Invocationhandler interface in the two list collection, and the Proxyconnection object is also the proxy object that is generated based on it. We call Pooleddatasource's getconnection () method to return the Proxyconnection object, and when we call any of the methods on this Proxyconnection object, Invokes the Pooledconnection object within the Invoke () method to load the Org.apache.ibatis.session.Configuration object as a container for all configuration information, Config The organizational structure of the Uration object is almost identical to the organizational structure of the XML configuration fileThe process of MyBatis initialization is the process of creating a configuration object,The initialization of mybatis occurs in Sqlsessionfactorybuilder.builder, which calls the parse () method of Xmlconfigbuilder, and then returns the Configuration object The implementation mechanism of MyBatis's transaction managementMyBatis's transaction management is divided into two forms:first, the transaction management mechanism using JDBC: The Java.sql.Connection object is used to complete the commit (commit ()), rollback (rollback ()), Close (Close ()), etc.              second, the use of managed transaction management mechanism:This mechanism mybatis itself not to implement transaction management, but to let the container of the program (Jboss,weblogic) to implement the management of the transaction MyBatis framework is divided into: interface layer, data processing layer (framework support) interface layer MyBatis and database interaction has two Type of method:a. Using the API provided by the traditional MyBatis(sqlsessionUnderStatement IDInMyBatisConfiguration objectsConfigurationGets to the correspondingmappedstatementobject, and then call theMyBatisActuator to perform the specific operation.B.Using the Mapper interface, purely to meet the needs of interface-oriented programming, the principle and a-like frame supportTransaction Management Mechanisms connection pooling Management mechanism Caching mechanism9 Three ways to connect multiple tables HASH join MERGE join NESTED loophttp://blog.csdn.net/tianlesoftware/article/details/5826546<context:property-placeholder  Location="Classpath:/config/ibatis/jdbc.properties"/>Countdownlatch used for multithreaded testing Redis expiration Time settingshash Internal key set expiration time? instantiation and automated assembly work for Spring MVC<content:component-scan base-package= "" annotation-config= "true"/><Aop:aspectj-autoproxy />      system initialization, Component-scan scan (Controller, Service, Repository) The Beandefinition instance is then put into beanfactory, and Annotation-config's settings are registered Autowiredannotationbeanpostprocessor (the instance is automatically assembled) to the Bean factory , the bean instance initialization is the first time the bean instance is requested, and the getbean,spring of Spring calling Beanfactory examines the constructor that determines the call. and instantiate the Bean. When the instantiation is complete, spring invokes the Populatebean method of the Bean factory, and the Populatebean method calls the Beanpostprocessor instance to complete the automatic assembly of the property element. To populate the attributes of the bean instance, which is the automatic assembly we mentioned earlier, spring checks to see if the assembled property has other properties for automatic assembly, and then recursively calls the Getbean method. Until all @autowired elements are assembled @autowired is automatically assembled according to the type. If there is more than one Userdao type of bean in the spring context, you can use @qualifier mates @autowired to resolve these issues   @Aspectpublic class aspectanotationclass{      @PointCut ("Execution (* * (..) &&annotation (COM ... ClassName))      public void Gg () {}       @Before ("GG ()")      public void Beforefun () {}      @After ("GG ()")      public void Afterfun () {}     @ Around ("GG ()")      public Object aroundfun (proceedingjoinpoint PJP){}     }

Java Interview Problem collection (2)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.