Java pen questions with the mind

In the cow brush off questions online, recording some of the wrong questions.

  • No operator = <<<

  • Execution sequence: static block of code> code block configuration> Constructor

  • Static variables and the order of execution of code blocks before and after the code sequence is

  • The execution order of
    the parent class static block
    itself Static blocks
    parent block
    parent class constructor
    self block
    itself constructor

  • Assignment step procedure for
    assigning static variable parent class
    own static variable assignment
    parent class member variable assignment
    parent class assignment block
    parent class constructor assignment
    itself member variable assignment
    self block assignment
    itself constructor assignment

  • If there is no sub-class constructor call display super () constructor, it will be inserted by default

  • The first column of the index line is recorded ResultSet 1

  • All enumeration class enumerates constant values ​​are static class, for the first time at initialization time will initialize all the enumeration value object

  • Thread-safe classes: Vector, HashTable, StringBuffer, Properties

  • final point just the same, but the point values ​​are likely to change, so still not thread safe

  • Operation is not volatile variable atomicity

  • Only the same class loader loads the class of the same name is a class

  • Integer as time passed as a parameter will unpack into the value passed

  • Java Database Connectivity JDBC library to use bridge mode, JDBC provides two interfaces, one for database vendors, a JDBC-oriented users.

  • Xmx: maximum heap size Xms: initial heap size Xmn: the young generation Size XXSurvivorRatio: the young generation area and the size ratio of Eden region Survivor

  • Inheritance is transitive

  • (TestClass)null == TestClass

  • Class B derived from class A, then class A class B may access the public, protected members

  • Local variables must be initialized display

  • Java implementation of a real array, to avoid the possibility of overwriting data

  • Methods area in the JVM is a very important area, and stack it, is shared by the thread area. In the process area, stores information for each class (including the name of the class, method information, field information), static variables, constants, and the compiler code and the like.

  • Hard link is the use of multiple aliases for the same file. If the contents of the file stored in the user data block is a pointer to another file path name, the file is a soft link

  • Stack inherited Vector, it is also thread-safe

  • HashMap Hashtable contains methods removed, because it contains could easily misunderstood

  • Persistent with the main storage for storing static data types, such as Java Class, Method, etc., not Java object relationship with the garbage collector to collect. The heapspace divided with the young and old with. Young generation garbage collection called Young GC, old generation garbage collection is called Full GC.

  • Persistent heap memory is the storage place bytecode file object, because usually the object of each .class files are only one, decided by the uniqueness of the fully qualified class name and class loader of this object, not the normal program overflow, only the modified class loader, bytecode generate a large number of file object will overflow.

  • JVM heap memory is divided into two: Permanent Space and Heap Space.
    Permanent ie permanent generation (Permanent Generation), the main storage of the Java class definition information, not Java object relationship with the garbage collector to collect.
    Heap = {Old + NEW = { Eden, from, to}}, Old i.e. old generation (Old Generation), New Generation i.e. Young (Young Generation). Old generation and the young generation is divided relatively large impact garbage collection right.

  • Java run-time memory division and visibility thread
    threads share: method area, heap area
    thread private: virtual machine stack, native method stacks, program counter

  • Java heap memory settings principle

  • Methods java language belongs to the members of the object, rather than members of the class

  • Subclasses When overriding methods inherited from the base class can not reduce the visibility of the method

  • final type of the variable must be initialized because final variables can not be changed

  • *% And it is the same priority, from left to right operation

  • It can be protected to the same package other types of access, but can also give the subclass access not in the same package.

  • ReadWriteLock applies to read how much to write concurrency scenarios

  • CopyOnWriteArrayList apply to write much less read concurrency scenarios

  • An abstract class can have a constructor, an interface can not have constructors

  • When all classes have been necessary loading is completed, begin main () method body

  • I exist so that the number i + 1 <, if i is an int, then when the maximum integer int i can be represented as, i + 1 becomes negative the overflowed

  • px = dp*(dpi/160)

  • Public Object methods: equals () hashcode () toString () getClass () notify () notifyAll () wait ()

Personal GitHub: http://github.com/icodeu

CSDN blog: http://blog.csdn.net/icodeyou

Personal Micro Signal: qqwanghuanTechnical Exchange

image

Original: Big Box  Java pen questions with the mind


Guess you like

Origin www.cnblogs.com/petewell/p/11615202.html