In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "what are the 10 concepts that must be understood before the Java interview". In the daily operation, I believe there are doubts about the 10 concepts that many people must understand before the Java interview. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubts of "what are the 10 concepts that you must know before the Java interview?" Next, please follow the editor to study!
1. Initialization of object
(1) initialization of non-static objects
When you create an object, all data members of the class in which the object resides are initialized first.
Basic type: int type, initialized to 0.
If it is an object: these objects are initialized sequentially.
The function of the constructor is to initialize.
(2) initialization of static objects
The static variable of the main class in the program is initialized before the main method executes. Not only will all static variables in the class be initialized when the object is created * *, but all static variables will also be initialized in the order in which they are in the class when accessing the static object of a class (note that no such object is created at this time).
2. when inheriting, the initialization process of the object
(1) the superclass of the main class initializes static members sequentially from high to low, regardless of whether the static members are private or not.
(2) initialization of static members of the main class.
(3) the superclass of the main class invokes the default constructor from high to low. Note that the superclass is initialized with a non-static object before calling the default constructor for each superclass.
(4) initialization of non-static members of the main class.
(5) call the constructor of the main class.
3. About the construction method
(1) A class may not have a constructor, but if there are multiple constructors, there should be a default constructor, otherwise when inheriting this class, one of the non-default constructors of the parent class needs to be explicitly called in the subclass.
(2) in a constructor, other constructors can only be called once, and the statements that call the constructor must be * statements.
4. About public, private and protected
(1) A class without public modification can be accessed by other classes under the following conditions: a. The two classes are in the same file, b. Two classes are in the same folder, c. The two classes are in the same package.
(2) protected: inherited classes and classes of the same package can be accessed.
(3) if the constructor is private, then objects of this class cannot be created in other classes.
5. Abstract class
(1) Abstract classes cannot create objects.
(2) if a method in a class is an abstract method, the class must be an abstract abstract class.
(3) classes that inherit abstract classes must implement abstract methods in abstract classes.
(4) there can be abstract methods or non-abstract methods in abstract classes. Abstract method cannot be private.
(5) the class that inherits the abstract class indirectly can not give the definition of abstract method.
6. Final keyword
(1) an object is a constant, it does not mean that the members of the object cannot be transformed, and its members can still operate.
(2) constants must be assigned before they are used, but they can only be initialized in the constructor except at the same time as the declaration.
(3) final-modified methods cannot be reset (methods with the same name cannot appear in subclasses).
(4) if a class is declared as final, all methods are final, regardless of whether it is modified by final or not, but the data member may or may not be final.
7. Interface interface (using implements to implement the interface)
(1) all data in the API are static and final, that is, static constants. Although you can modify without these two keywords, you must assign an initial value to the constant.
(2) the methods in the interface are all public. In the implementation interface class, the implementation method must be public keyword.
(3) if public is used to decorate the interface, the interface must be the same as the file name.
8. Multiple inheritance
(1) if a class inherits a class and an interface, the class must be written first, the interface later, and the interfaces separated by commas.
(2) there can be multiple inheritance between interfaces. Pay attention to the use of the keyword extends.
(3) although a class implements only one interface, it should not only implement all the methods of this interface, but also implement the methods of the interface inherited by this interface. All methods in the interface must be implemented in the class.
9. Interface embedding
(1) the interface is embedded in the class and can be decorated with private. At this point, the interface can only be implemented in the class in which it is located, and other classes cannot access it.
(2) the interface embedded in the interface must be public.
10. Embedding of classes
(1) A class can be embedded in another class, but not in an interface.
(2) in static methods or other methods, inner class objects can not be created directly, but need to be obtained by means.
At this point, the study of "what are the 10 concepts you must know before Java interview" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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