In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-15 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 basic interview questions of Java language". In daily operation, I believe that many people have doubts about the basic interview questions of Java language. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the questions of "what are the basic interview questions of Java language?" Next, please follow the editor to study!
1. What are the characteristics of object-oriented?
1) abstraction: abstraction is to ignore aspects of a topic that have nothing to do with the current goal in order to pay more attention to the aspects related to the current goal. The abstraction does not intend to understand all the problems, but only chooses some of them, without some details for the time being. Abstraction includes two aspects, one is process abstraction, the other is data abstraction.
2) inheritance: inheritance is a hierarchical model that joins classes, and allows and encourages class reuse, which provides a way to clearly express commonalities. A new class of an object can be derived from an existing class, a process called class inheritance. The new class inherits the characteristics of the original class, which is called the derived class (subclass) of the original class, and the original class is called the base class (parent class) of the new class. A derived class can inherit methods and instance variables from its base class, and the class can modify or add new methods to better suit specific needs.
3) Encapsulation: encapsulation surrounds the process and data, and the data can only be accessed through a defined interface. Object-oriented computing begins with the basic concept that the real world can be depicted as a series of fully autonomous, encapsulated objects that access other objects through a protected interface.
4) Polymorphism: polymorphism means that different types of objects are allowed to respond to the same message. Polymorphism includes parametric polymorphism and inclusion polymorphism. Polymorphic language has the advantages of flexibility, abstraction, behavior sharing and code sharing, which solves the problem of the same name of application function very well.
2. Scope public,private,protected, and the difference when not writing?
A: the differences are as follows:
The scope of the current class is the same as that of descendants.
Public √
Protected √ ×
Default √ √ × ×
Private √ × × ×
Defaults to default when not writing.
3. Is String the most basic data type? [basic]
A: no.
4. Is float float filler 3.4 correct? [basic]
Answer: incorrect
The precision is not accurate and a cast should be used, as follows: float f = (float) 3.4.
Or use float f = 3.4f
5. The statement float fallows 1.3; can the compilation pass? [basic]
A: no
Cast should be used, as follows: float f = (float) 1.3
Or use float f = 1.3f
6. Short S1 = 1; S1 = S1 + 1; what's wrong with it?
Short S1 = 1; S1 + = 1; what's wrong? [fundamentals]
Answer: short S1 = 1x S1 = S1 = S1; S1: the result of the operation is int, which requires forced conversion; short S1 = 1; S1 + = 1; it can be compiled correctly, and the type can be upgraded automatically.
7. Does Java have goto? [fundamentals]
A: goto is a reserved word in java and is not currently used in java.
8. What's the difference between int and Integer? [basic]
Answer: Java provides two different types: reference type and original type (or built-in type)
Int is the raw data type of java, and Integer is the wrapper class provided by java for int.
Java provides wrapper classes for each primitive type:
Original type: boolean,char,byte,short,int,long,float,double
Encapsulation type: Boolean,Character,Byte,Short,Integer,Long,Float,Double
The behavior of the reference type and the original type is completely different, and they have different semantics. Reference types and primitive types have different characteristics and uses, including size and speed issues, which type of data structure this type is stored in, and the default values specified when the reference type and the original type are used as instance data for a class. The default value of object reference instance variables is null, while the default values of primitive type instance variables are related to their types.
9. The difference between & and &? [basic]
Answer: & is the bit operator for bitwise and operation, and & & is the logical operator for logic and (and).
10. Briefly describe the difference between logical operations (&, |, ^) and conditional actions (& &, | |)? [basic]
A: there are two main differences:
a. Conditional operations can only operate on Boolean types, while logical operations can operate not only on Boolean types, but also on numerical types.
b. Logical operations do not cause a short circuit.
At this point, the study of "what are the basic interview questions of Java language" 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
© 2024 shulou.com SLNews company. All rights reserved.