Java EE interview Summary (i)

Source: Internet
Author: User
Tags float double thread class

  1. The difference between JDK and JRE:
    A: The JDK is the Java language Development kit that contains the JRE and development Kit (Java,exe, etc.), the Java language of the runtime environment, including the JVM and the core class library, the JVM is a Java virtual machine, to ensure that the Java cross-platform nature
  2. Is the JVM cross-platform?
    JVM is a Java virtual machine, different operating systems corresponding to the JVM, the JVM does not have cross-platform
  3. Reserved words
    Reserved words are keywords that are not yet used, and may be used in later versions of Java, Goto and const
  4. Features of the Java language:
    Fully object-oriented, cross-platform, open source, safe, reliable, high performance, multi-threading, robustness,
  5. Is main the key word?
    No, main is the name of the main function, which can be recognized by the virtual machine and is the entrance to the program execution.
  6. The difference between path and classpath:
    The PATH environment variable is configured with the execution path of the executable file. exe, and the bytecode file execution path for the classpath configured Java language post-compilation sound field
  7. The most basic storage unit for a computer is: bytes
    Computer direct recognition of binary: binary
  8. What is the difference between a variable and a constant:
    The value of a variable during the operation is varied, can be assigned multiple times, and the constant is fixed.
  9. Categories of variable data types:
    Variables need to be defined first, then assigned, and then used
    Basic Data type: 4 Class 8 kinds of byte short int long float double char Boolean
    Reference data types: arrays, classes, interfaces
  10. Constant classification:
    Custom constants: Constants defined by themselves through final adornments
    Literal constants: include integers, decimals, booleans, characters, strings
  11. Range of byte: 128 127
    Range of char: 0 65535
  12. Long is 8 bytes, float is 4 bytes, why long is smaller than float
    The underlying arithmetic rules are different
  13. + + and--the use of:
    When used alone, the same as before and after
    To participate in the operation, the first is self-added or self-reduction, after the first to participate in the operation, in the self-added or self-reduction
  14. Logic | and short-circuit | | The difference
    | No matter what the front is, it's true. Arithmetic, | | The front is true and does not participate in the operation, improving the efficiency of the operation
  15. The difference between logic & and short-circuit &&
    & regardless of the front is really will arithmetic, && front if False, the back of the not participate in the operation, improve the efficiency of the operation
  16. The difference between while and dowhile,for:
    Do While is the first execution after the judgment
    While and for the first judgment after execution, the For loop ends, its defined initialization condition can no longer be used
  17. The difference between break and continue:
    Break is completely out of the loop, continue is jumping out of the loop, making the next loop
  18. The difference between method overloads and method overrides:
    Method overloading is a method with the same name in the same class, with a different argument list, regardless of the return value
    Method overrides between subclasses, when a subclass appears and the parent class declares exactly the same method, becomes a method override, overriding requires that the return value be the same or that there is a word parent class relationship
  19. Construction method, the Set method can assign a value to a member variable, the difference between the two assignments?
    The main function of the construction method is to initialize the object, assignment is only his part-time work, can also not assign value
  20. The difference between a static block of code and a block of construction code:
    Static code blocks belong to a class, initialize the class, and the class is loaded and executed only once
    Constructs a code block to initialize the object uniformly, and executes once for each time it is created
  21. Four types of permission modifiers:
    Public PROTECTD Default Private
  22. The difference between = = and equal:
    "= =" is a comparison operator that can compare basic data types, have a reference data type that can be compared, the base data type compares a numeric value, and the reference data type compares the address value
    Equal is a method that overrides the equal method to compare the contents of an object, and if there is no override the equal method that will call object, compare the address value
  23. The difference between string and StringBuffer and StringBuilder:
    String is a special reference data type, is a sequence of characters can not be changed, no buffer, once created can not be changed, even if the re-assignment is not changed on the original basis, but instead of re-created an object, will refer to this new object, waste space, inefficient
    StringBuffer and StringBuilder are a container that is a variable sequence of strings
    StringBuffer, thread-safe, low-efficiency,
    The bottom of the StringBuilder is a character array, the thread is unsafe, the efficiency is higher
  24. Collection system:
  25. The difference between ArrayList and LinkedList:
    ArrayList data structure of the underlying data, query slow, and delete quickly
    LINKEDLISTD Bottom is linked list, delete fast, query slow
  26. A brief introduction to the data structure:
    Stack: Advanced post-out, press stack, bounce stack
    Queue: FIFO
    Linked list: Each element points to the next element
    Arrays: A fast contiguous storage area
  27. Thread and Process Multithreading:
    A process is an executing program, each program has at least one control unit, a running program
    A thread is a control unit in a process that controls the execution of a process and is the execution path of a process.
    Multithreading: Multiple execution paths for a process, each execution path is a thread
  28. Multithreading concurrency and multithreading parallelism:
    When two or more tasks send requests, the CPU can execute only one, alternating these tasks, and the CPU switches execution at high speed, which is multithreading concurrency
    Multi-threaded parallel, two or more tasks executed simultaneously, provided the multicore CPU
  29. Features of Multithreading: randomness and delay
  30. Two ways to implement a thread:
    Inherit the thread class, the advantage is inheritance, code is simple, can directly use the method of thread, the disadvantage is poor extensibility, should inherit the thread class, can not inherit other classes
    The advantage of implementing the Runnable interface is that the extensibility is strong, the disadvantage: The code is more, cannot directly use the thread class
  31. The life cycle of a thread:
    New ready to run (may block and wait) death
  32. The difference between sleep and wait:
    Sleep is to get the thread asleep, must give the corresponding time, time to the automatic wake, sleep without giving up the CPU execution right
    Wait is to let the thread wait, can pass the parameter also can not pass the parameter, the argument is lets wait after the specified time, needs to be awakened, waits the time to abandon the CPU execution right
  33. To suspend a thread:
    Wait: Let the thread wait, wait for the time to abandon the CPU's execution right
    Yield: Let the thread pause and execute other threads
  34. What is an IO stream:
    Used to interact data between hard disks and memory.
  35. IO Stream classification
  36. The difference between close () and flush ():
    Flush () is used to refresh the buffer, after the refresh or can be written again
    Close () is used to shut down resources and cannot be written out after closing.

Java EE interview Summary (i)

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.