Java Development Engineer Latest Interview Question Book Series - Java Basic Part (With AP) - Programmer All
Java Development Engineer Latest Interview Question Book Series - Java Basic Part (With AP) - Programmer All
Programmer All
(https://www.programmerall.com)
technical sharing website that all programmers love
search
https://programmerall.com/article/72342042355/ 1/17
14/01/2022 09:41 Java Development Engineer Latest Interview Question Book Series - Java Basic Part (with AP) - Programmer All
Java foundation
If you have a better idea, please leave your answer in the
comment area, exchange discussions together.
1. What are the characteristics of object-oriented?
A: JDK is the environment you need when Java developed. It contains the API you need to use when Java development. JRE
answer: Is operators in Java, equals is an object provided by Object objects in Java comparison API. Their difference is The
comparison is the memory address of the left and right object, and equals compares the value of the left and right objects.
A: They are the permissions modifiers in Java, and the public can access anywhere. Private can only access in this class,
protected can be accessed in this class and the subclass of this class. The default representative can be in this package.
access
A: Short is converted to int type when calculating with the int type, because Java is less than Int.Numerical operationWhen
it is automatically converted to INT, it is calculated. The calculated result is also int, and then assigning the int type to the
short type, which will of course report. S1 = S1 + 1 is wrong However, S1 + = 1 is the conversion of the form of compiled
syntax in the bottom of Java, which is still converted to int calculation after compiling, but finally once a strong turn.
A: Wrong, because the decimal decimal refers to the Double in the Java, Double type, Double Float is 4 bytes, and
automatic conversion cannot be completed. If you need to convert a fractional decimal amount to a Float type, you need
to add f or f.
A: The former is with the symbol, the latter is a short circuit and symbol. In addition to the logical operation and the bit
operation, the former is called "bit and", the latter can only do logic, followed by the two symbols, the two symbols require
A: 2 << 3
https://programmerall.com/article/72342042355/ 2/17
14/01/2022 09:41 Java Development Engineer Latest Interview Question Book Series - Java Basic Part (with AP) - Programmer All
A: Value delivery is the data in the variable, and the application transfer is a reference to the transfer variable rather than
the value.
Answer: 8 basic data types in Java passes values, and reference data types are passed by reference
A: You can only have a public static void mi method, with a minimum of one class.
A: Decorative class: final class, non-subject inheritance, modification method: final method, non-subject method cover,
modified variable: constant, must be assigned to the declaration, and the subsequent program is not changed.
A: In addition to the name of the image, it is the same. Final belongs to the Java modifier, Finally is used to close some
resources in conjunction with the TRY in the Java exception, Finalize is a method in the Object root class, which is the
A: Void is the keyword represents the return value in Java, and Void is a class name.
A: Yes, Char defaults to 2 bytes, but char usesUTF-16BEThe coding set, and the coding set supports Chinese, and Char can
A: The overload is in the same category, satisfying the reload requires the same name, the parameter list is different, and
the return value and the access modifier are independent. Rewrite is in inheritance relationship, the subclass is covered
with the parent class method, and it is necessary to satisfy "a two small" (the method name is the same, the return value is
less than or equal to the parent class method, the declaration of the abstitute is less than or equal to the parent class
method, Access rights deconance is greater than or equal to the parent class)
A: The constructor can be overloaded, but it cannot be rewritten because the constructor cannot be inherited.
A: Whether the final result used to detect the expression or method is in line with expectations
A: Error is a system error, generally due to system reasons or JVM internal errors, cannot be captured by programs,
Exception is an exception, where it is compiled (check) abnormal and runtime exception, can be captured by programs,
https://programmerall.com/article/72342042355/ 3/17
14/01/2022 09:41 Java Development Engineer Latest Interview Question Book Series - Java Basic Part (with AP) - Programmer All
A: NullPointException null pointer exception, Arithmeticexception count abnormalities, ClassCastException type conversion
abnormal, ClassNotFoundException class to find abnormal, illegalargumentexception method parameter error exception,
A: NosuchMethodError finds the method exception (when the reflection call method), NUMBERFORMATEXCEPTION value
24. What is the difference between abnormal operation and an abnormality in the operation?
answer:
Runtime exceptions include the RuntimeException class and their subclasses, indicating that
the JVM may have an exception that can occur during operation. The Java compiler does not
check the running exception.
Immodation is impending in Exception Except except for the abnormality outside of its
subclasses. The Java compiler will check for all.
The difference between the inertimeException is abnormal and the subject: Whether to force
the caller to handle this exception, if the mandatory caller must perform, then use the
inspection exception, otherwise you choose non-check exception (RuntimeException).
Generally speaking, if there is no special requirement, we recommend using the
runtimeException exception.
A: throw is used to throw an exception in the method, and the throws written behind the method name for declaration of
exception types.
A: INT is the basic data type of Java, Integer is a reference data type of Java. Integer is an int package class, which provides
an API for INT conversion and calculation, which is more convenient to operate
A: The package type is a package of basic data types. The bottom layer is actually the API and syntax of the basic data type.
A: Basic data type transfusion data type is automatic unpacking, vice versa
https://programmerall.com/article/72342042355/ 4/17
14/01/2022 09:41 Java Development Engineer Latest Interview Question Book Series - Java Basic Part (with AP) - Programmer All
32. How do you understand the automatic type conversion and mandatory type conversion in Java?
A: Small transfers automatic conversion, expands the memory byte of the variable. Large transformation, reduce memory
A: Grammatical sugar
answer:
A: Yes, Switch supports int, Byte, Short, Char, and corresponding packaging classes, and string types
A: As above
A: It is not possible, and the literal strings in Java are stored in the string constant pool, which cannot be changed, only
referenced.
A: Because if you use a + number spliced string JVM compile, it will be optimized and converted to StringBuilder stitching. A
single expression is not large, but if you are multiple expressions or use the StringBuilder object frequently in the loop to
A: The former thread safety efficiency is low, and the latter thread is not safe.
https://programmerall.com/article/72342042355/ 5/17
14/01/2022 09:41 Java Development Engineer Latest Interview Question Book Series - Java Basic Part (with AP) - Programmer All
joiner1.add("1").add("2").add("3");
System.out.println(joiner1.toString());
//1,2,3
joiner2.add("1").add("2").add("3");
System.out.println(joiner2.toString());
//[1,2,3]
joiner3.add("1").add("2");
//'1','2'
42. What is the difference between ordinary classes and abstract classes?
43. What is the difference between static internal classes and ordinary internal classes?
A: Ordinary internal class holds an external external class, the properties and methods of the external class can be called,
while the static internal classes do not hold external references and cannot call the external methods and properties.
Static internal classes can have static members (methods, attributes), rather than static internal classes, unable to have
static members (methods, properties). Non-static internal classes can access static and non-statistial members of the
external class. Static internal classes cannot access non-static members of the external class, only the static members of
1. Static internal class: do not rely on external classes, directly instantiate internal class objects
2. Non-static internal classes: generate internal class objects through an external class object instance
44. Can a static method can call non-static methods directly? Why?
A: You can't, because the loading order of the static method is preferred in the non-static method, and the static method
belongs to the class, there is no need to instance, the non-static method needs the instance of the class to call
45. What is the difference between static variables and strength variables?
A: Static variables belong to the class, without having to create an object can be called by class name, and the instance
variable requires a class to create an instance to call. The loading angle is as long as the JVM is loaded with the class, the
static variables and can be used, which is allocated. And instance variables need to be assigned space after creating
objects
A: Non-static internal class can be used because it holds references outside the holder.
A: There is no construction method, abstract classes. There are ordinary member variables in the abstract class; there is no
ordinary member variable in the interface. The abstract class can contain non-abstract common methods; all methods in
the interface must be abstract, and there is no abstract approach. A class can achieve multiple interfaces, separated by a
https://programmerall.com/article/72342042355/ 6/17
14/01/2022 09:41 Java Development Engineer Latest Interview Question Book Series - Java Basic Part (with AP) - Programmer All
comma, but only one abstract class; the interface can not be implemented, but can inherit the interface, and can inherit
A: Generate a string of random numbers, it guarantees that all the machines in the same air are unique
A:
A: Hashcode is used in Java to represent the unique code of the object. Hashcode is also used in the Hash data structure,
used to calculate the location (storage address) in the HASH (storage address)
answer:
1. The Hashcode method in the Object class will return a Hash code, only the reference variable call to the same object
will return the same value, and the String class is relaxed, and the value in the object is also returned to the same
https://programmerall.com/article/72342042355/ 7/17
14/01/2022 09:41 Java Development Engineer Latest Interview Question Book Series - Java Basic Part (with AP) - Programmer All
value.
2. The IdentityHashCode method is the method in the System class. When calling the method, the HashCode method
in the object class is executed regardless of whether the HashCode method in the Object class is rewritten, and a
HashCode value is returned. So only the same value is returned to the reference variable call to the same object.
A: Both objects are placed in the same HASH container and the calculated HASH value is the same. Also known as the Hash
answer:
RetentionPolicy.Class ------------ annotation available in the class file, but will be discarded by VM
RetentionPolicy.Runtime ------- VM will also retain the comment during the running period, so information can be
@Documented: Do you want to retain your annotation when you use the Javadoc tool to generate a help document?
answer:
E --Element (used in the collection, because the elements are stored in the collection, also means the type in the
Collection container)
Class in the Java source code represents the class corresponding to this type, while Class <? > Indicates classes that
type uncertainty.
A: The conversion of complex operations is completed by providing simple writing methods. It is usually referred to as a
simple syntax in Java, which is restored to the basis syntax during the compilation period.
A: This property will not be serialized when you add keyword transient, serialized, and serialize it.
https://programmerall.com/article/72342042355/ 8/17
14/01/2022 09:41 Java Development Engineer Latest Interview Question Book Series - Java Basic Part (with AP) - Programmer All
A: Java object clone is divided into copies and shallow copies, shallow copies call Object to inherit the Clone, deep copy can
be achieved with the SpringFramework provided by the beanutils tool provided by SpringFramework or serialization with
60. What is the difference between the object clone shallow copy and deep copy?
A: Shallow copy and deep copy difference, shallow copy: If the object also includes a child object, the shallow copy can only
copy the memory space of the parent object, while the child object is only copied, the value is not copied. The deep copy is
A: Reflection allows the program to have the ability to detect yourself and get current operational environments at
runtime.
Understanding the reflex mechanism To understand the static compilation and dynamic compilation, the compile time
before the program is compiled, and the dynamic compiling can be run during operation, so that the program changes its
behavior mode or logic, high flexibility. . Typical programming design mode dynamic proxy is compiled during the running
period
answer:
Advantages: Enhanced procedures flexibility and expandability, can help programs to decoupled, improve their
adaptability
shortcoming:
1、 Performance problem.
Java reflection mechanism contains some dynamic types, so Java virtual machines cannot optimize these dynamic code.
Therefore, the efficiency of the reflection operation is much lower than the normal operation efficiency. We should avoid
using reflections in the code that is highly required or frequently performed. Moreover, how to use reflection determine
the performance of performance. If it functions as a fewer runs in the program, performance will not be a problem.
2、Safety limit.
Using reflections typically requires no security restrictions. It is best not to use reflection if a program is required for
security.
3、Program robustness.
Reflection allows the code to perform some operations that are usually not allowed, so it is possible to use reflex that can
lead to unexpected consequences. The reflection code destroys the abstraction of the Java program structure, so when the
platform is running, the results of the code generated due to the abstract logical structure cannot be identified, the results
A: Reference with macro variables, the system will automatically replace the macro variable to
the value of the address he pointed out.
https://programmerall.com/article/72342042355/ 9/17
14/01/2022 09:41 Java Development Engineer Latest Interview Question Book Series - Java Basic Part (with AP) - Programmer All
String nb = "finaltest";
System.out.println(nb == nb3);
System.out.println(nb == nb4);
System.out.println(nb == nb5);
true
false
true
NB defines FinalTest, NB3 defines "Final" + "Test". When the NB3 will determine the initial value of
FINALTEST (JVM), the initial value is equal to NB when compiling), so the initial value is equal to NB. There
fore, the address referenced by the NB3 is directed to the address referenced by the NB, so NB is equal to NB
3.
And the NB11, NB22 knows that the macro variable according to the three rules, references the macro
variable, the system automatically replaces the macro variable to the value of the address he pointed to, so
the NB11 + NB22 will replace it into FinalTest, then with NB3, this It is a macro replacement.
A: In the compilation optimization of the programming language, the method of analyzing the dynamic range of the
pointer is called the escape analysis. It is popular that when an object's pointer is quoted by multiple methods or threads,
The method used to analyze this escape is called the escape analysis. Global variable assignment, method return value,
https://programmerall.com/article/72342042355/ 10/17
14/01/2022 09:41 Java Development Engineer Latest Interview Question Book Series - Java Basic Part (with AP) - Programmer All
*1.*Sharing is a memory area data by multiple processor, and the pseudo sharing is not true.
Sharing this concept is based on logical levels. In fact, pseudo-sharing and sharing is actually
shared on Cache Line.
*2.*The data accessed by the CPU is read from the Cache Line. If the CPU does not find the
required variables in cache, it is called the cache. **
When not hys, you need to read into cache from the memory through the bus. The memory
size read at a time is the size of a cache line.
3. **** If the different memory variables of multiple CPUs are loaded into the same cache line,
they speak from the program logic layer and have no sharing variables.
4. **** Pseudo-Sharing and Sharing on the level of Cache Line must be shared. Multiple CPUs
ensure access security of shared memory by cache consistency.
*5*The pseudo-sharing problem is difficult to discover, because the thread may access a
completely different global variable, but the memory happens in a very similar position. For
example, many other concurrency problems, avoiding the most basic way for pseudo-sharing
is to carefully review the code, adjust your data structure according to the cache line.
A: The core characteristics lambda expression and function interface and stream API
A: Lambda is an anonymous function, you can understand the Lambda expression as a passable code (passing the code
like data). You can write a more concise, flexible code. As a more compact code style, Java's language expression capability
is improved.
A: @RepeAtable can be used to indicate some type of annotation that can be added repeatedly
A: Method reference, if the function interface and the specific implementation, the method can be directly referenced.
https://programmerall.com/article/72342042355/ 11/17
14/01/2022 09:41 Java Development Engineer Latest Interview Question Book Series - Java Basic Part (with AP) - Programmer All
A: Support for collection calculations, the collection is responsible for storage and Stream is responsible for calculation. It is
used to operate the sequence generated by the data source, such as complex lookup, filter map data, etc.
A: The function can be assigned to other variables as other data types, or it can be used asparameterCan also be used
asreturn value。
Easy in parallel
Delay
answer:
74. What is serialization, how to serialize, why sequential, anti-sequence, how to solve it.
A: Serialization is to convert object data stored in memory to binary data that can be saver or network transmission. There
are many ways to serialize, first of all, the sequential classes are required to implement the ObjectOutputStream or JSON
format serialization provided by Serializable Common JDK. The reverse sequence may encounter the inconsistency of the
diameterized version of the diamond, and the sequence and reverse sequence version is required.
(https://www.programmerall.com/article/64262317088/?
utm_source=vdoai_stories)
(https://www.programmerall.com/article/8572971242/?
utm_source=vdoai_stories)
(https://www.programmerall.com/article/1488234417/?
utm_source=vdoai_stories)
(https://www.programmerall.com/article/30642317091/?
utm_source=vdoai_stories)
SpringBoot's mapping rules for static resources
(https://www.programmerall.com/article/32182317095/?
utm_source=vdoai_stories) (https://vdo.ai?
utm_medium=stories&utm_term=programmerall.com&utm_so
https://programmerall.com/article/72342042355/ 12/17
14/01/2022 09:41 Java Development Engineer Latest Interview Question Book Series - Java Basic Part (with AP) - Programmer All
Intelligent Recommendation
[Java Interview Question series first] (/article/79171113760/)
transient: The variables declared with Transient declarations do not need to be maintained, mainly for serialization; volatile: The Volatile modifie
r tells the compiler to be modified by the volatile ...
More Recommendation
"OD Interview" Java Software Engineer (/article/6863975603/)
One, JVM automatic memory management mechanism 1. Java memory model 1.1 Data area shared by all threads: 1.1.1 Method Area, Non-Heap
The user stores data such as class information, constants, static v...
https://programmerall.com/article/72342042355/ 13/17
14/01/2022 09:41 Java Development Engineer Latest Interview Question Book Series - Java Basic Part (with AP) - Programmer All
Related Posts
Java Development Engineer Latest Interview Question Board Series - MYBATIS Framework Section (with AP) (/article/42242023857/)
Java Development Engineer Latest Interview Question Board Series - Spring section (with answers) (/article/29592034958/)
Java development engineer latest interview question bank series - Web section (with answer) (/article/29022041428/)
[Java Interview Question Series 1] Interview Question sum - Java foundation part (/article/7707201929/)
Java Interview Series Part 1 - Basic Types and Reference Types (/article/41941385572/)
Popular Posts
Inheritance of VC++ (2) (/article/8634663814/)
Introduction to mybatis (introduction, mybatis entry program (add, delete, modify, check)) (/article/8482282307/)
SpringBoot-SpringSecurity (/article/99472179207/)
https://programmerall.com/article/72342042355/ 15/17
14/01/2022 09:41 Java Development Engineer Latest Interview Question Book Series - Java Basic Part (with AP) - Programmer All
Recommended Posts
The process of obtaining mobile phone number by WeChat applet (/article/5541692362/)
ASP.NET Uploading big files appear web page Unable to display (/article/88441318277/)
https://programmerall.com/article/72342042355/ 16/17
14/01/2022 09:41 Java Development Engineer Latest Interview Question Book Series - Java Basic Part (with AP) - Programmer All
Related Tags
Mybatis (/tag/Mybatis/)
frame (/tag/frame/)
Interview (/tag/Interview/)
Java (/tag/Java/)
https://programmerall.com/article/72342042355/ 17/17