admin 发表于 2017-3-8 20:04:32

2017年小米春招内推面试面经

<p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">首先,我感到很讶异的是,在我投完简历一天后(2017年2月 23日),小米的工作人员就打电话给我,并且敲定了电话面试的日期(2017年2月27日)。当时我还在家里享受着寒假呢,这也许是来自东北某末流985的优势吧2333。</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">  在等待面试的这几天中,我感到非常惶恐,毕竟我始终没有料到小米会这么早让我面试(宝宝的内心是崩溃的,我还没准备好!)于是乎我开始恶补<a href="http://lib.csdn.net/base/17" class="replace_word" title="Java EE知识库" target="_blank" style="color: rgb(223, 52, 52); text-decoration: none; box-sizing: border-box; font-weight: bold;">Java</a>知识(我面的是Java后端开发)以及牛客网上刷&lt;&lt;剑指offer&gt;&gt;编程题。PS:强烈建议大家去牛客网上刷题哦,很有用!</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">  面试当天,我既紧张又期待,抱着试一试的心态,终于等来了面试官的电话。他让我准备好一台电脑(用来现场撸代码),然后让我打开一个指定的网址。由于我当时还在实验室里,于是我专门找了一个人少的地方进行面试,生怕吵到同学(其实是怕出丑)。</font></p><hr style="box-sizing: border-box; margin-top: 2em; margin-bottom: 2em; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-style: solid; border-top-color: rgba(128, 128, 128, 0.0980392); color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">  首先开始一面。一上来,还是依旧自我介绍,说实话,我原先并没有准备这个环节,所以讲的非常仓促,没有条理(我自己都不知道在讲什么 ,大概是 自己的基本信息以及学习过的编程语言)。下面我整理一下面试官问的问题:</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">1、说说你对java的认识?&nbsp;<br style="box-sizing: border-box;"><font size="3" style="box-sizing: border-box;">2、对java了解哪些?&nbsp;<br style="box-sizing: border-box;"><font size="3" style="box-sizing: border-box;">3、说说java集合类?</font></font></font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;">ANSWER:</p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" color="red" style="box-sizing: border-box;"> 友情链接:<a href="http://www.cnblogs.com/leeplogs/p/5891861.html" style="color: rgb(202, 0, 0); text-decoration: none; box-sizing: border-box;">java集合解析</a></font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" color="red" style="box-sizing: border-box;"> 友情链接:<a href="http://baike.baidu.com/link?url=5119-Wby2SWY_eEkENWj9FSr-YMAVilDSeJSwNH4Z40alGwE2Yib1TVkBSgD3vWp1q6sqUXiPDhhedonz1omkxsV0B3plZPzIAL3f0QmQzv4Obt7a9R5ABB4SrLRAB1Q" style="color: rgb(202, 0, 0); text-decoration: none; box-sizing: border-box;">java集合类</a></font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" color="red" style="box-sizing: border-box;"> 友情链接:<a href="http://blog.csdn.net/pistolove/article/details/41453705" style="color: rgb(202, 0, 0); text-decoration: none; box-sizing: border-box;">集合详解</a></font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">4、说说Java多线程的内容?(同步机制等)</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">其中第三个问题,他又延伸开来,问了我:</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">①TreeMap与HashMap区别?实现原理?</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">②List的实现原理?</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">③ArrayList初始化的默认长度?ArrayList的长度是固定的吗?其实现的原理是什么?</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">ArrayList的底层是由一个Object[]数组构成的, 而这个Object[]数组,默认的长度是10 。</font></p><pre class="prettyprint" name="code" style="white-space: nowrap; box-sizing: border-box; position: relative; overflow-y: hidden; overflow-x: auto; margin-bottom: 1.1em; font-family: 'Source Code Pro', monospace; padding: 5px 5px 5px 60px; font-size: 14px; line-height: 1.45; word-break: break-all; color: rgb(51, 51, 51); border: 1px solid rgba(128, 128, 128, 0.0745098); border-radius: 0px; background-color: rgba(128, 128, 128, 0.0470588);"><code class="hljs javascript has-numbering" style="display: block; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace; font-size: inherit; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">ArrayList&lt;<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">String</span>&gt; al = <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">new</span> ArrayList&lt;<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">String</span>&gt;();</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; padding-top: 6px; padding-bottom: 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; padding-top: 6px; padding-bottom: 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">1</li></ul></pre><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">  如果直接打印al.size()当然是0,size()方法,因为10指的是“逻辑”长度。 所谓“逻辑”长度,是指内存已存在的“实际元素的长度” 而“空元素不被计算“;即:当你利用add()方法,向ArrayList内添加一个“元素”时, 逻辑长度就增加1位。 而剩下的9个空元素不被计算。</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><img src="http://img.blog.csdn.net/20170227200803973?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvc2luYXRfMzU1MTIyNDU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="这里写图片描述" title="" style="border: none; box-sizing: border-box; max-width: 100%;"></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">下面是ArrayList的部分源代码:</font></p><pre class="prettyprint" name="code" style="white-space: nowrap; box-sizing: border-box; position: relative; overflow-y: hidden; overflow-x: auto; margin-bottom: 1.1em; font-family: 'Source Code Pro', monospace; padding: 5px 5px 5px 60px; font-size: 14px; line-height: 1.45; word-break: break-all; color: rgb(51, 51, 51); border: 1px solid rgba(128, 128, 128, 0.0745098); border-radius: 0px; background-color: rgba(128, 128, 128, 0.0470588);"><code class="hljs cs has-numbering" style="display: block; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace; font-size: inherit; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">&lt;pre name=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"code"</span> class=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"html"</span>&gt; <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">public</span> <span class="hljs-title" style="box-sizing: border-box;">ArrayList</span>()
{
    <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">this</span>(<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">10</span>);
}</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; padding-top: 6px; padding-bottom: 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">1</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">2</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">3</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">4</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; padding-top: 6px; padding-bottom: 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">1</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">2</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">3</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">4</li></ul></pre><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">  java自动增加ArrayList大小的思路是:向ArrayList添加对象时,原对象数目加1如果大于原底层数组的长度,则以适当长度新建一个原数组的拷贝,并修改原数组,指向这个新建数组。原数组自动抛弃(java垃圾回收机制自动回收)。size则在向数组添加对象,自增1。</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" color="red" style="box-sizing: border-box;"> 友情链接:<a href="http://blog.csdn.net/u011794238/article/details/49179125" style="color: rgb(202, 0, 0); text-decoration: none; box-sizing: border-box;">&nbsp;常用容器制定初始化容量</a></font></p><hr style="box-sizing: border-box; margin-top: 2em; margin-bottom: 2em; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-style: solid; border-top-color: rgba(128, 128, 128, 0.0980392); color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">第四个问题,他也有延伸开来,问了我:</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">①synchronize关键字的相关内容;</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">②<a href="http://blog.csdn.net/sinat_35512245/article/details/54955174" style="color: rgb(202, 0, 0); text-decoration: none; box-sizing: border-box;">volatile关键字的相关内容</a>;</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">  问完这些问题,就开始了最为残忍的现场撸代码环节:(首先问了我对于排序<a href="http://lib.csdn.net/base/31" class="replace_word" title="算法与数据结构知识库" target="_blank" style="color: rgb(223, 52, 52); text-decoration: none; box-sizing: border-box; font-weight: bold;">算法</a>了解吗?)</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" color="red" style="box-sizing: border-box;"> 友情链接:<a href="http://blog.csdn.net/sinat_35512245/article/details/52757801" style="color: rgb(202, 0, 0); text-decoration: none; box-sizing: border-box;">关于排序算法的理解(一)</a></font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">1、二分查找</font></p><pre class="prettyprint" name="code" style="white-space: nowrap; box-sizing: border-box; position: relative; overflow-y: hidden; overflow-x: auto; margin-bottom: 1.1em; font-family: 'Source Code Pro', monospace; padding: 5px 5px 5px 60px; font-size: 14px; line-height: 1.45; word-break: break-all; color: rgb(51, 51, 51); border: 1px solid rgba(128, 128, 128, 0.0745098); border-radius: 0px; background-color: rgba(128, 128, 128, 0.0470588);"><code class="hljs java has-numbering" style="display: block; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace; font-size: inherit; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-javadoc" style="color: rgb(136, 0, 0); box-sizing: border-box;">/**
* Created by HuangQinJian on 2017/2/27.
*/</span>
<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">public</span> <span class="hljs-class" style="box-sizing: border-box;"><span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">class</span> <span class="hljs-title" style="box-sizing: border-box; color: rgb(102, 0, 102);">main</span> {</span>
    <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">public</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">static</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">int</span> <span class="hljs-title" style="box-sizing: border-box;">sort</span>(<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">int</span> da[], <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">int</span> a) {
      <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">int</span> len = da.length;
      <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">int</span> left = <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span>, right = len - <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span>;
      <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">int</span> mid = <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span>;
      <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">while</span> (left &lt;= right) {
            mid = (left + right) / <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2</span>;
            <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">if</span> (a &lt; da) {
                right = mid - <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span>;
            } <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">else</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">if</span> (a &gt; da) {
                left = mid + <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span>;
            } <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">else</span> {
                <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">return</span> mid;
            }
      }
      <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">return</span> -<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span>;
    }

    <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">public</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">static</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">void</span> <span class="hljs-title" style="box-sizing: border-box;">main</span>(String[] args) {
      <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">int</span> a[] = {<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span>, <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2</span>, <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">6</span>, <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">87</span>, <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">456</span>, <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">899</span>};
      <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">int</span> result = sort(a, <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">899</span>);
      System.out.println(result);
    }
}</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; padding-top: 6px; padding-bottom: 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">1</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">2</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">3</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">4</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">5</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">6</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">7</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">8</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">9</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">10</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">11</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">12</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">13</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">14</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">15</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">16</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">17</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">18</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">19</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">20</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">21</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">22</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">23</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">24</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">25</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">26</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">27</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; padding-top: 6px; padding-bottom: 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">1</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">2</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">3</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">4</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">5</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">6</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">7</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">8</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">9</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">10</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">11</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">12</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">13</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">14</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">15</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">16</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">17</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">18</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">19</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">20</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">21</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">22</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">23</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">24</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">25</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">26</li><li style="box-sizing: border-box; padding-right: 5px; padding-left: 5px;">27</li></ul></pre><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">2、冒泡排序</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">3、快速排序(算法复杂度)</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">4、给一个无序数组int[] nums 和一个整数 target,在这个数组中找到两个数 ,使得这个两个数的和等于target,找到这个数组中所有的满足这样条件的数。</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">附上现场截屏图片:(图中代码请忽略,应该有错)</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><img src="http://img.blog.csdn.net/20170227192655900?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvc2luYXRfMzU1MTIyNDU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="这里写图片描述" title="" style="border: none; box-sizing: border-box; max-width: 100%;"></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">  代码写完以后,面试官跟我说一面到此结束,待会会由他的同事对我进行二面。</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">  然后,此时我的内心是奔溃的,竟然还有二面!竟然这么快就二面了!</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">  大概过了半小时后(煎熬的等待),又一个电话打来,说是对我进行二面(讲道理,我此时没有那么紧张)。开始照样是自我介绍,还是无厘头的自我介绍,不过跟第一次的自我介绍讲的内容完全不同,不要问我是怎么做到的,我自己也不知道!</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">  然后,他的第一个问题问的是关于我项目的一些内容,这我就不详细介绍了,毕竟每个人的项目经历都是不一样的。(不过,我想说,项目经历很重要!!大概是关于&nbsp;<a href="http://lib.csdn.net/base/17" class="replace_word" title="Java EE知识库" target="_blank" style="color: rgb(223, 52, 52); text-decoration: none; box-sizing: border-box; font-weight: bold;">spring</a>+SpringMVC+Mybatis的)</font></p><hr style="box-sizing: border-box; margin-top: 2em; margin-bottom: 2em; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-style: solid; border-top-color: rgba(128, 128, 128, 0.0980392); color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;"><strong style="box-sizing: border-box;">关于面试中问到的SSM框架的工作原理:</strong></font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;"><strong style="box-sizing: border-box;">Spring</strong>&nbsp;<br style="box-sizing: border-box;"><font size="3" style="box-sizing: border-box;">Spring就像是整个项目中装配bean的大工厂,在配置文件中可以指定使用特定的参数去调用实体类的构造方法来实例化对象。&nbsp;<br style="box-sizing: border-box;">Spring的核心思想是IOC(控制反转),即不再需要程序员去显式地<code style="box-sizing: border-box; font-family: 'Source Code Pro', monospace; padding: 2px 4px; font-size: 14.4px; color: rgb(63, 63, 63); white-space: nowrap; border-radius: 0px; background-color: rgba(128, 128, 128, 0.0745098);">new</code>一个对象,而是让Spring框架帮你来完成这一切。</font></font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;"><strong style="box-sizing: border-box;">SpringMVC</strong>&nbsp;<br style="box-sizing: border-box;"><font size="3" style="box-sizing: border-box;">SpringMVC在项目中拦截用户请求,它的核心Servlet即DispatcherServlet承担中介或是前台这样的职责,将用户请求通过HandlerMapping去匹配Controller,Controller就是具体对应请求所执行的操作。SpringMVC相当于SSH框架中Struts。</font></font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;"><strong style="box-sizing: border-box;">Mybatis</strong>&nbsp;<br style="box-sizing: border-box;"><font size="3" style="box-sizing: border-box;">Mybatis是对JDBC的封装,它让<a href="http://lib.csdn.net/base/14" class="replace_word" title="MySQL知识库" target="_blank" style="color: rgb(223, 52, 52); text-decoration: none; box-sizing: border-box; font-weight: bold;">数据库</a>底层操作变的透明。Mybatis的操作都是围绕一个SqlSessionFactory实例展开的。Mybatis通过配置文件关联到各实体类的Mapper文件,Mapper文件中配置了每个类对数据库所需进行的sql语句映射。在每次与数据库交互时,通过SqlSessionFactory拿到一个SqlSession,再执行sql命令。</font></font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">SSM框架的Web程序主要用到了三个技术:</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">Spring:用到了注解和自动装配,就是Spring的两个精髓IOC(反向控制)和 AOP(面向切面编程)。&nbsp;<br style="box-sizing: border-box;"><font size="3" style="box-sizing: border-box;">SpringMVC:用到了MVC模型,将逻辑代码放到Controller层处理。&nbsp;<br style="box-sizing: border-box;"><font size="3" style="box-sizing: border-box;">Mybatis:用到了与数据库打交道的层面,放在所有的逻辑之后,处理与数据库的CRUD相关的操作。</font></font></font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">要完成一个功能:</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">1、先写实体类entity,定义对象的属性,(可以参照数据库中表的字段来设置,数据库的设计应该在所有编码开始之前)。&nbsp;<br style="box-sizing: border-box;"><font size="3" style="box-sizing: border-box;">2、写Mapper.xml(Mybatis),其中定义你的功能,对应要对数据库进行的那些操作,比如 insert、selectAll、selectByKey、delete、update等。&nbsp;<br style="box-sizing: border-box;"><font size="3" style="box-sizing: border-box;">3、写Mapper.java,将Mapper.xml中的操作按照id映射成Java函数。&nbsp;<br style="box-sizing: border-box;"><font size="3" style="box-sizing: border-box;">4、写Service.java,为控制层提供服务,接受控制层的参数,完成相应的功能,并返回给控制层。&nbsp;<br style="box-sizing: border-box;"><font size="3" style="box-sizing: border-box;">5、写Controller.java,连接页面请求和服务层,获取页面请求的参数,通过自动装配,映射不同的URL到相应的处理函数,并获取参数,对参数进行处理,之后传给服务层。&nbsp;<br style="box-sizing: border-box;"><font size="3" style="box-sizing: border-box;">6、写JSP页面调用,请求哪些参数,需要获取什么数据。</font></font></font></font></font></font></p><hr style="box-sizing: border-box; margin-top: 2em; margin-bottom: 2em; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-style: solid; border-top-color: rgba(128, 128, 128, 0.0980392); color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">  接着,他就开始问我一些关于数据库方面的问题:</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">1、对于数据库事务的了解?———<a href="http://www.cnblogs.com/fjdingsd/p/5273008.html" style="color: rgb(202, 0, 0); text-decoration: none; box-sizing: border-box;">数据库事务的四大特性以及事务的隔离级别</a></font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">2、介绍一下数据库范式?———<a href="http://blog.csdn.net/sinat_35512245/article/details/52923516" style="color: rgb(202, 0, 0); text-decoration: none; box-sizing: border-box;">关于SQL数据库中的范式</a></font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">3、重载与重写的区别?———<a href="http://blog.csdn.net/sinat_35512245/article/details/54773552" style="color: rgb(202, 0, 0); text-decoration: none; box-sizing: border-box;">重载、重写(覆盖)的区别实例分析</a></font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">4、数据库优化?———<a href="http://www.jb51.net/article/19024.htm" style="color: rgb(202, 0, 0); text-decoration: none; box-sizing: border-box;">SQL 优化经验总结34条</a></font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">  最后,终于机会反转,他问我有什么想问的问题,我大概问了几个问题(关于技术以及一些琐碎的东西)。最后的最后,他让我等通知,我估计是黄了。</font></p><p style="margin-bottom: 1.1em; box-sizing: border-box; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><font size="3" style="box-sizing: border-box;">  漏了一点,他还我问了我能实习多久(感觉他很在意这个),刚开始还问我有没有实习经历(我也很绝望啊,我才大三啊,我哪来的实习机会!)</font></p><hr style="box-sizing: border-box; margin-top: 2em; margin-bottom: 2em; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-style: solid; border-top-color: rgba(128, 128, 128, 0.0980392); color: rgb(0, 0, 0); font-family: 'microsoft yahei'; font-size: 14px; line-height: 26px;"><h2 id="具体更多资源可前往java后端面试总结" style="margin-top: 0.8em; margin-bottom: 0.8em; box-sizing: border-box; font-weight: 100; color: rgb(0, 0, 0); font-family: 'microsoft yahei'; line-height: 26px;">具体更多资源可前往<a href="https://github.com/HuangQinJian/Interview-questions" style="color: rgb(202, 0, 0); text-decoration: none; box-sizing: border-box;">Java后端面试总结</a></h2><p></p>
页: [1]
查看完整版本: 2017年小米春招内推面试面经