Interview questions J2SE (a) the basic concepts

Interview questions J2SE (a) the basic concepts

Transfer: J2SE the Java interview questions, get registered

More content, you can click the link above to view all their own

1. Object-oriented features have what?

Packaging
The most common is the property privatization encapsulated in a class which can only be accessed via the method to
inherit
subclass inherits the parent class, which inherits the methods and properties of the parent class
abstract
such a hero class, the abstract name, hp these properties, so that the development process more readily appreciated
polymorphic
polymorphism polymorphism and polymorphic class division operator. Polymorphism refers to the class parent class object reference to point to a child, and inheritance, there is rewritten.

2. String is the most basic data type?

String is a class type , not a basic type.
There are eight basic types of
the eight basic types are:
Integer (four kinds)
character (one kind)
float (2 types)
Boolean (1 species)

3. int and Integer What is the difference?

int 32-bit integer type basic length
Integer class type is an int wrapper class
by and between int Integer autoboxing automatic unboxing interchangeable

4. String and StringBuffer difference?

String is immutable , the content once created, no changes can occur.
StringBuffer is variable length, content can also be changed
to change the principles of the internal StringBuffer using the character array stored data, the need to increase the length of time, creates a new array and copies the original data to a new array of such an approach to realise.

5. What are the similarities and differences with the general exception runtime exception?

Runtime exceptions also known as non-checked exceptions, during compilation, are not required to display catch
general exception also known to be investigated abnormalities in the compilation process, must be processed, or capture, or by throws throw to.

6. The storage properties and characteristics say ArrayList, Vector, LinkedList of

Let me talk ArrayList and Vector
both inherited abstract class AbstractList, but Vector is thread-safe , but not thread-safe ArrayList

Besides ArrayList and LinkedList difference between
ArrayList is an array structure, positioning fast, but very slow to insert and delete
LinkedList is a doubly linked list structure, insert and delete quickly, but the positioning is very slow

7. Collection and Collections of the difference

First, do not say that as a singular, one is plural. . .
Collection is the interface, is the parent Set List and Interface
Collections is a utility class, providing sorting, confusion and so many practical methods

And & & & distinction 8.

& It has two functions, namely, the bit with and logic
&& is the logical AND
as a logical AND, and & && represent long and short circuit path with the
long sides of the road, will be operational
shorted as long as the first one is false, a second operation is not performed

9. HashMap and the difference Hashtable

HashMap and Hashtable implement the Map interface, are key to the way data is stored
difference 1:
HashMap can store null
Hashtable can not store null
difference 2:
HashMap is not thread-safe class
Hashtable is thread-safe class

Distinction 10. final, finally, finalize the

Final
Final modification classes, methods, basic types of variables when referenced each with a different meaning
modified class represents the class can not be inherited
modification method indicates that the method can not be overridden
modified basic types of variables indicates that the variable can only be assigned once
modified references indicates that the reference to an object only once chance to
a finally
a finally for exception handling scene, regardless of whether an exception is thrown, will execute
the Finalize
the Finalize method is the object of all classes inherit the method. When an object satisfying the condition of the garbage collection, and when recovered, which finalize () method will be called

View the original more

Published 32 original articles · won praise 182 · views 10000 +

Guess you like

Origin blog.csdn.net/weixin_44092440/article/details/89256881