Ali JAVA intern entry test questions (2019-date)

According to my understanding and information collected, as clear and complete answer (gradually improve, continuously updated)

1, String class Why is final

Firstly String source:

public final class String
    implements java.io.Serializable, Comparable<String>, CharSequence {
    /** The value is used for character storage. */
    private final char value[];
  • Class is limited to the final keyword, that it can not be inherited, no subclasses. That holds a String object reference, it must be the String class, but will not be another class.
  • value is used to store the value, which is a private final char array, the array can not be replaced described other arrays - i.e., the address of the array can not be changed, but each element of the array can be changed Found

private qualifier guaranteed String string array outside the class can not be modified. Since no external exposure can modify the interface, so the value of String Once created, that can not be modified.

  • Thread Safety

Because the string can not be modified, i.e., multiple threads may share the same instance of a string.

  • String constant pool can greatly improve the spatial efficiency

      String constant pool, see     https://segmentfault.com/a/1190000009888357

2, HashMap source of JDK8, implementation principle underlying structure

  HashMap Hash of conflict resolution, would later write a separate blog

  • First look at the source Node
    static class Node<K,V> implements Map.Entry<K,V> {
        final int hash;
        final K key;
        V value;
        Node<K,V> next;

        Node(int hash, K key, V value, Node<K,V> next) {
            this.hash = hash;
            this.key = key;
            this.value = value;
            this.next = next;
        }

   HashMap with  transient Node <K, V> [ ] table stored value, is a singly linked list

  • capacity
static final int DEFAULT_INITIAL_CAPACITY = 1 << 4; // aka 16

The default capacity-16. When resize, newCap = OLDCAP <<. 1 (binary 2, the left one, i.e., * 2)

3, reflection, and the Class.forName ClassLoader.loadClass difference

4, session and cookie differences and connections, session life cycle, when more than one service deployment session management
5, Java queue in what are, what difference
6, go into the details about the Java memory model and the GC algorithm
7, JAVA10 , the new features JAVA11

JAVA10 new features official release page:  https://www.oracle.com/technetwork/java/javase/10-relnote-issues-4108729.html

  • New Optional.orElseThrow () method
  • Add a few unmodifiable the Collections the API, such as Collectors class add  toUnmodifiableListtoUnmodifiableSetand toUnmodifiableMap methods
  • ...

JAVA11 new features official release page:   https://www.oracle.com/technetwork/java/javase/11-relnote-issues-5012449.html

8, investigation targeting Java memory leak problem: jmap, jstack use
9, Spring architecture and jar use
10, operation principle of Spring MVC
11, during the execution of Spring Boot's
12, Spring IOC and AOP underlying implementation
14, Spring boot strengths and weaknesses, as well as application scenarios such as
15, to talk about the advantages and disadvantages of Dubbo Sping Cloud and
16, what is Hystrix? how does it achieve fault tolerance?

hystrx works, see  https://segmentfault.com/a/1190000012439580


17, what Netflix Feign? What are its advantages?
18, to talk about the theory of distributed consistency to the CAP, BASE theory

CAP (the Compare and swap)
19, common thread pool thread pool mode and the use of different scenes - interview appears very high frequency

  • FixedThreadPool
  • CachedThreadPool
  • SingleThreadExecutor
  • ScheduledThreadPool  

Recommended:  https://blog.csdn.net/z_s_z2016/article/details/81674893

20, the difference between the synchronized ReentrantLock and
understanding keyword 21, atomicInteger and volatile such as thread-safe operation and use of
22, distributed lock the three ways
23, using the socket frame netty, and the realization of the principle NIO, why is asynchronous non obstruction
24, the best practices outlined NIO
25, uses Zookeeper, the principle is what elections
26, a handwriting Huffman

Huffman (Huffman Tree), also known as optimal binary tree

 

*****************************************************************************************************

Energy is limited, too much desire, focus on doing one thing on the line

  • 5 years to write the code, technology blog scrutiny of every word, and insist on zero-copy original
  • Meaning a blog that exercise logical rational, systematic deepen the understanding of knowledge, writing exercise, and if just a little help to others, then it is a very happy thing

*****************************************************************************************************

Guess you like

Origin www.cnblogs.com/NaughtyCat/p/alibaba-java-interview.html