JAVA Interview Tips (XI)

● Oracle basic data types
Oracle basic data type (common):

1, character

char string of a fixed length of 2,000 bytes

accounting for variable-length string varchar2 4000 bytes

nvarchar2 of 2,000 characters (save up to 2000 letters / Chinese)

2, the large object type (LOB)

Blob: maximum length binary data 4G

Blob used to keep some pictures, videos, files.

Clob: 4G maximum length character data, and can save large string varchar2 nvarchar2 has certain limitations, their limited length, but with the database, whether or nvarchar2 varchar2 type, or use CLOB, the java String receiving end uses.

3, numeric

Integer Integer type, small integers.

Float Float type.

Real Real type.

Number (p, s) contains the value of the type of decimal places. P represents precision, s represents the number of digits after the decimal.

Eg: number (10,2) can be represented by 8 digits before the decimal point, there are two decimal places.

4, date type

Date Date (day - month - year) DD-MM-YY (HH-MI-SS)

Timestamp with date than it is accurate to microseconds. Exact range of 0 to 9 default 6.

sleep () and wait () method What is the difference?
1, sleep is a method of the Thread class (Thread), leading to this thread to suspend the specified time, the opportunity to perform other threads, but monitoring status remains, to the post will be automatically restored. Call sleep will not release the object lock.

wait is a method of the Object class, object calls this method leads to wait this thread to give the object lock, waiting to enter the pool waiting for a lock for this object, and only issued after notify method (or notifyAll) for this thread to lock this object before entering the target pool to get ready object lock into operation.

2, sleep () and yield () What is the difference?

1) sleep () method does not consider the priority of the thread when other threads to run opportunities, so the opportunity to give low priority thread to run; yield () method will only give the same priority or higher priority thread to chance to run;

2) After the thread execution sleep () method into the blocked (blocked) state, and after the implementation of yield () method into the ready (ready) state;

3) sleep () method declaration throws InterruptedException, while the yield () method does not declare any exceptions;

4) sleep () method than the yield () method (associated with the operating system) more portable.

Say something strong references, soft references, weak references, phantom references, and gc and the relationship between them?
Strong references: a reference to new object and the like,

As long as the reference is still strong, never recovered

Soft references: references, but not necessarily object memory overflow exception before recovery

Weak references: non-essential objects, objects survive garbage collection occurs before the next to the next.

False quote: no effect on survival time, to be notified when garbage collection.

Original articles published 0 · won praise 0 · Views 587

Guess you like

Origin blog.csdn.net/qq_41490913/article/details/105021569