Java Development Post-test questions

Source: Internet
Author: User
Tags square root asymmetric encryption

See some Java interview questions, ready to do it yourself and try it out.

First, the Java Foundation

1. Why is the string class final?

    1. A string pool is possible only if the string is immutable. The implementation of a string pool can save a lot of heap space at run time, because different string variables point to the same string in the pool. However, if the string is mutable, then string interning will not be implemented (note: string interning refers to just one save for different strings, that is, not many of the same strings are saved.) Because then, if the variable changes its value, the value of the other variable that points to that value will also change.
    2. If the string is mutable, it can cause serious security problems. For example, the user name and password of the database are passed in as strings to get a connection to the database, or in socket programming, the hostname and port are passed in as a string. Because the string is immutable, its value is immutable, otherwise hackers can drill into the empty, change the value of the object that the string points to, resulting in a security breach.
    3. Because strings are immutable, multithreading is secure, and the same string instance can be shared by multiple threads. This will not use synchronization because of thread-safety issues. The string itself is thread-safe.
    4. The ClassLoader uses a string, and immutability provides security so that the correct class is loaded. For example, if you want to load the Java.sql.Connection class, and this value is changed to myhacked.connection, it will cause an unknown damage to your database.
    5. Because the string is immutable, hashcode is cached when it is created and does not need to be recalculated. This makes the string well suited as a key in the map, and the string is processed faster than other key objects. This is where keys in hashmap tend to use strings.

2. HashMap The source code, the realization principle, the bottom structure.

3. Say you know a few Java collection classes: List, set, queue, map implementation class ...

4. Describe the respective implementations and differences between ArrayList and LinkedList

5. What is the difference between the queues in Java.

6. The difference between class.forname and ClassLoader in reflection

7. New features of Java7 and Java8 (Baidu asks, good BT)

8. The operational efficiency of both the Java array and the linked list, in which cases (starting from the beginning, starting at the end, starting from the middle), which operations (INSERT, find, delete) are highly efficient

9. The problem of Java Memory leak survey location: the use of jmap,jstack and so on

Ten. String, StringBuilder, StringBuffer differences

The difference between Hashtable and HashMap.

13. Exception structure, run-time exceptions and non-runtime exceptions, each of the examples

String a= "abc" string b = "abc" String c = new String ("abc") string d = "AB" + "C". The result of comparing them with = =

General methods of the String class

What kinds of reference types are there in Java?

17. The difference between abstract classes and interfaces

The underlying type and byte size of java.

Hashtable,hashmap,concurrenthashmap Basic implementation principle and thread safety (it is recommended to be familiar with JDK source code to answer calmly)

20. If you do not want to use the tools provided by the Java JDK, you implement a map yourself, what you do. Said for a long time, said HashMap source code, if I do, will learn from the principle of HashMap, said a pass HashMap realize

What about the hash conflict? What are the methods for resolving hash conflicts?

HashMap The conflict is very bad, the worst performance, how will you solve? from O (n) to log (n), the idea of a binary sort tree is said

Rehash.

Hashcode () and Equals () generation algorithm, method how to rewrite

Second, Java IO

1. Talk about the common classes in Io, byte stream, character stream, interface, implementation class, method blocking.

2. Talk about NiO.

3. What is the difference between String encoding UTF-8 and GBK?

4. When to use byte stream, when to use character stream?

5. Recursively read the file under the folder, how the code is implemented

Third, the Java Web

1. Session and Cookie differences and links, session life cycle, multiple services deployed when session management.

2. Some related issues with Servlets

3. WebService related issues

4. JDBC Connection, forname method, how to declare the use of a transaction. Example and specific code

5. Configuration of the main configuration of Web. XML without Frames

6. The difference between JSP and servlet

Iv. JVM

1. Java's memory model and GC algorithm

2. What does JVM performance tuning do?

3. Describe the 7 areas in the JVM, and then describe the circumstances in which each zone could cause a memory overflow

4. Describes the GC and GC root unhealthy references.

5. From classload loading mode, loading mechanism, from the program runtime data area, talk about memory allocation, talk about the string constant pool, talk about the JVM garbage collection mechanism, algorithm, hotspot. Anyway, it's all kinds of extensions

6. How the JVM allocates direct memory, how the new object is not allocated on the heap but on the stack, and constant pool parsing

7. How large the array is placed in the JVM older generation (not just set up pretenuresizethreshold, ask how often, do not ask a question to know)

8. How arrays are accessed in the old age

9. GC algorithm, how to GC for permanent objects, how to handle GC loops

10. Who will be GC and when GC

11. What to do if you want to not be GC

12. What to do if you want to survive in GC 1 times

v. Open source Framework

1. The difference between hibernate and Ibatis

2. Talk about the MyBatis connection pool.

3. What jar packages need to be referenced in the spring framework, and the purpose of these jar packages

4. Principle of SPRINGMVC

5. Meaning of SPRINGMVC annotations

6. Links and differences between beanfactory and ApplicationContext in spring

7. Several ways of spring injection (cyclic injection)

8. How spring implements the management of things

9. Springioc

Principles of Spring AOP

How to use the 1-level and 2-level caches in Hibernate and the difference principle (lazy-load understanding)

Hibernate's principle architecture, five core interfaces, hibernate object three state transitions, transaction management.

six, multi-threaded

1. After Java creates a thread, call the start () method directly and the difference between run ()

2. Common thread pool patterns and usage scenarios for different thread pools

3. Newfixedthreadpool this kind of thread pool what to do if the number of threads reaches the maximum value, the underlying principle.

4. Multi-threaded communication between the synchronization problem, synchronized lock is the object, stretch out and synchronized related to a lot of specific problems, such as the same class different methods have synchronized lock, whether an object can be accessed at the same time. Or the static construction method of a class plus the effect of a lock after synchronized.

5. Understanding the meaning of reentrant locks and the difference between Reentrantlock and synchronized

6. Synchronized data structures, such as Concurrenthashmap's source understanding and internal implementation principles, why he is synchronous and highly efficient

7. Understanding and Using keywords for thread-safe operations such as atomicinteger and volatile

8. Inter-thread communication, wait and notify

9. Use of timed threads

10. Scenario: In a main thread, a large number of (many) sub-threads are required to execute before the main thread finishes. Many ways to consider efficiency.

11. The difference between a process and a thread

12. What does thread safety mean? Examples Show

13. Several states of a thread

14. Concurrency, synchronization of interfaces or methods

HASHMAP is thread safe and why is it unsafe? Concurrenthashmap, thread safety, why security. What is the underlying implementation.

The use of common classes under J.U.C. An in-depth study of threadpool; the use of blockingqueue. (The difference between take,poll, put,offer); The implementation of atomic classes.

17. A brief introduction to the situation of multithreading, starting with the creation of a thread. Then how to control the synchronization process, multithreading common methods and structure

Understanding of volatile

19. There are several ways to achieve multithreading, multi-threaded synchronization How to do, say a few lines thread commonly used methods

Vii. network communication

1. HTTP is stateless communication, HTTP request method, you can define a new request method.

2. Socket communication, as well as long connection, subcontracting, connection abnormal disconnection processing.

3. Use of the socket communication model, AIO and NIO.

4. The use of the socket frame Netty, and the implementation principle of NIO, why asynchronous non-blocking.

5. Synchronous and asynchronous, blocking and non-blocking.

6. OSI seven layer model, including some basic knowledge of TCP,IP

7. The difference between get post in HTTP

8. Talk about the relationship between HTTP,TCP,UDP and the difference.

9. Talk about how the browser accesses the www.taobao.com, and what the process has gone through.

HTTP protocol, HTTPS protocol, SSL protocol and full interactive process;

TCP congestion, fast backhaul, packet drop of IP

One procedure for HTTPS processing, symmetric and asymmetric encryption

All features and distinctions of head

14. Talk about how the browser accesses the www.taobao.com, and what the process has gone through.

viii. MySQL Database

1. mysql's storage engine is different

2. Single index, federated index, primary key index

3. How MySQL is divided into tables, and what to do if you want to query by conditional paging (if you do not query by table field, almost inefficient, no solution)

4. After the table wants to make an ID multiple table is self-increment, the efficiency realization

5. mysql master-slave real-time backup synchronization configuration, as well as the principle (from the library read the main library binlog), read and write separation

6. Write SQL statements ...

7. Indexed data structure, B + Tree

8. The four characteristics of the transaction, as well as their respective characteristics (atomic, isolated) and so on, how the project solves these problems

9. Database lock: Row lock, table lock, optimistic lock, pessimistic lock

10. Several granularity of database transaction;

11. Relationship-type and non-relational database differences

Nine, design mode

1. Singleton mode: Full Han, a hungry man. As well as lazy loading in a hungry man, double check

2. Factory mode, decorator mode, observer mode.

3. Advantages of the Factory method model (low coupling, cohesion, open closure principle)

10. Algorithm

1. Using a random algorithm generates a number that requires all of these numbers to be generated between 1-1000w. (Study high efficiency, solve the problem of conflict)

2. Merge sort of two ordered arrays

3. Reverse of an array

4. Calculate the positive square root of a positive integer

5. It is common to find, sort algorithms, and their time complexity

6. Traversal algorithm for two-fork tree

7. DFS,BFS algorithm

9. More important data structures, such as linked lists, queues, stacks of basic understanding and general implementation.

10. Sorting algorithm and space-time complexity (why is the fast row unstable, why your project is still in use)

11. Inverse Polish Calculator

Hoffman encoding

13. Find trees with red and black trees

11. Concurrency and Performance tuning

1. There is a 5k per second request, query the phone number of the place of the pen questions (remember incomplete, not listed), how to design the algorithm? More requests, such as 5w, how to design the entire system?

2. High concurrency, how our system supports a large number of requests

3. How the cluster synchronizes session state

4. Principle of Load Balancing

5. If there is a particularly large amount of traffic to the database, how to do optimization (db design, dbio,sql optimization, Java optimization)

6. If there is a large area of concurrency, on the basis of not increasing the server, how to resolve the server response is not timely problems. "

7. If your project has a performance bottleneck, what do you think it might be and how to solve the problem?

8. How to find the location that caused the performance bottleneck, which is the performance bottleneck.

9. Have you used the caching mechanism in your project? There is no use for user non-local cache

12. Other

1. Commands that are commonly used by Linux

Java Development Post-test questions

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.