Interview Diary--Alibaba JAVA interview __java

Source: Internet
Author: User
Tags garbage collection redis
Interview Diary--Alibaba Java interview

Ali's interview is the most stressful one, but also the most test of technology.
Did not expect Ali's interview notice is now received, can be said to be belated love it.
Interview The remote interview, need to share the desktop, online programming.
To line up on the official line, 1 hours in line, finally lined up.
Interview me is a very young Ali brother, is the framework of the Department of Business.

He mainly asked me the following questions (for common progress, I wrote the answer under the question, for reference only) 1. JVM Model

Http://www.cnblogs.com/AloneSword/p/4262255.html 2. Class loader

http://blog.csdn.net/gjanyanlig/article/details/6818655/ 3. Garbage Collection Classification

Http://www.cnblogs.com/davenkin/p/java-garbage-collection.html 4. View the garbage collection command

http://www.cnblogs.com/wozixiaoyao/p/5658952.html 5. Multiple ways of thread synchronization

http://blog.csdn.net/cengjingyige/article/details/52382300 6. The underlying implementation of Lucene

http://blog.csdn.net/njpjsoftdev/article/details/54015485 7. How the database MyISAM and InnoDB indexes are stored

Http://www.cnblogs.com/renzherushe/p/4780226.html 8. Redis Use Scenario

http://blog.jobbole.com/88383/ 9. Redis How to clear expired data

the host election mechanism of http://www.cnblogs.com/zhangchao-letv/articles/6119313.html Redis

Http://www.tuicool.com/articles/yiEnUj 11. The difference between Treepmap and hsahmap, the bottom implementation

Http://www.chinaitlab.com/Java/base/962510.html 12. What kind of design pattern is used in javaweb filter

Filter mode
http://www.runoob.com/design-pattern/filter-pattern.html 13. What design pattern is used for IO package input/output stream

Http://www.cnblogs.com/wxgblogs/p/5649933.html 14. What kind of internal class to get

http://blog.csdn.net/qq_32198277/article/details/72593825 15. Programming to implement the adorner mode

Http://www.runoob.com/design-pattern/decorator-pattern.html 16. Programming to implement menu level (up to three levels)

Didn't do it, now it's the easiest way to do it.
The idea is to use map to record selected, with two list to record the last selected and not selected (in fact, you can use a list plus iterators on the line)
Because it's up to three floors, you can use up to 3 for loops.

Import java.util.*;
        public class Main {class menu{private int id;
        private String name;

        private int pId;
            public Menu (int ID, String name, int pId) {this.id = ID;
            THIS.name = name;
        This.pid = pId;
        public int getId () {return id;
        The public void setId (int id) {this.id = ID;
        Public String GetName () {return name;
        public void SetName (String name) {this.name = name;
        public int getpid () {return pId;
        public void setpid (int pId) {this.pid = pid;
        Class result{private Menu menu;

        Private List<result>menus=new arraylist<> ();
        Public menu GetMenu () {return menu;
        public void SetMenu (Menu menu) {this.menu = menu; Public LisT<result> Getmenus () {return menus;
        public void Setmenus (list<result> menus) {this.menus = menus;
        } public void Test () {list<menu> menulist=new arraylist<> ();
        Menu Menu1=new Menu (1, "1", 0);
        Menu Menu2=new Menu (2, "2", 1);
        Menu Menu3=new Menu (4, "4", 1);
        Menu Menu4=new Menu (3, "3", 2);
        Menu Menu5=new Menu (5, "5", 2);
        Menu Menu6=new Menu (6, "6", 2);
        Menulist.add (MENU4);
        Menulist.add (MENU1);
        Menulist.add (MENU2);
        Menulist.add (MENU3);
        Menulist.add (MENU5);
        Menulist.add (MENU6);
        List<menu> menulist2=new arraylist<> (menulist);
        Map<integer,result> resultmap=new hashmap<integer,result> ();
        List<result>results=new arraylist<result> (); First for (Menu menu:menulist) {if (Menu.getpid () ==0) {result result=new result ();
                Result.setmenu (menu);
                Into the map, indicating that it has been selected Resultmap.put (Menu.getid (), result);
                Results.add (result);
            Remove the selected Menulist2.remove (menu);
        }//menulist and MenuList2 identity swaps menulist.clear ();
        Menulist.addall (MENULIST2);
            Scan to find the second or third layer for (Menu menu:menulist2) {result Result=resultmap.get (Menu.getpid ());
                if (result!=null) {result result1=new result ();
                Result1.setmenu (menu);
                Resultmap.put (Menu.getid (), RESULT1);
                Result.getmenus (). Add (RESULT1);
            Menulist.remove (menu); }//menulist and MenuList2 identity Interchange//scan found the remaining for the third layer for (Menu menu:menulist) {res
            Ult=resultmap.get (Menu.getpid ());
                if (result!=null) {result result1=new result ();
     Result1.setmenu (menu);           Result.getmenus (). Add (RESULT1);
            Resultmap.put (Menu.getid (), RESULT1);
        }} public static void Main (string[] args) {main main=new main ();
    Main.test ();
 }
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26-27--28 29---30 31--32 33 34 35 36 37 38-39 40 41 42 4 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103-104
Related Article

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.