In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Most people do not understand the knowledge points of this article "what are the basic interview questions in the java interview", so the editor summarizes the following contents, the content is detailed, the steps are clear, and it has a certain reference value. I hope you can gain something after reading this article. Let's take a look at this "what are the basic interview questions in the java interview" article.
1. Scope public,private,protected, and the difference when not writing
A: the differences are as follows:
Scope pre-class same package descendant class other package
Public √
Protected √ ×
Friendly √ √ × ×
Private √ × × ×
Defaults to friendly when not writing
2. Whether Anonymous Inner Class (anonymous inner class) can extends (inherit) other classes, and whether implements (implementation) interface (interface)
A: an anonymous inner class is an inner class without a name. You cannot extends (inherit) other classes, but an inner class can be implemented by another inner class as an interface
3. The difference between Static Nested Class and Inner Class
A: Nested Class (usually C++) and Inner Class (usually JAVA). The biggest difference between Java inner classes and C++ nested classes is whether they have references to the outside. Note: static inner class (Inner Class) means that 1 creates an object of a static inner class without the need for an external class object, and 2 cannot access an external class object from an object of an static inner class
4. The difference between & and &
Answer: & is a bit operator for bitwise and operation, and & & is a logical operator for logic and (and)
5. The difference between Collection and Collections
A: Collection is the parent interface of the collection class, and the main interfaces inherited from it are Set and List.
Collections is a helper class for collection classes. It provides a series of static methods to search, sort, thread-safe and other operations on various collections.
6. When to use assert
Answer: assertion (assertion) is a common debugging method in software development, and this mechanism is supported in many development languages. In implementation, assertion is a statement in the program, it checks a boolean expression, a correct program must ensure that the value of the boolean expression is true; if the value is false, indicating that the program has been in an incorrect state, the system will give warning or exit. Generally speaking, assertion is used to ensure the most basic and critical correctness of the program. Assertion checking is usually turned on during development and testing. To improve performance, assertion checking is usually turned off after the software is released
7. String s = new String ("xyz"); how many String Object have been created?
Answer: two, one character object, one character object reference object
8. How much is Math.round (11.5)? How much is Math.round (- 11.5)?
The Math.round method returns the long integer closest to the parameter, and its floor is calculated after adding 1 / 2 of the parameter.
9. Short S1 = 1; S1 = S1 + 1; what's wrong with it? Short S1 = 1; S1 + = 1; what's wrong?
Answer: short S1 = 1; S1 = S1; (S1 = S1) short S1 = 1; S1 + = 1; (can be compiled correctly)
10. Is there a goto in Java?
Answer: reserved words in java are not currently used in java
The above is about the content of this article "what are the basic interview questions in the java interview?" I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.