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--
This article introduces the relevant knowledge of "what are the basic knowledge points of JAVA programming language". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. What are the characteristics of object-oriented?
1. Abstract:
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.
two。 Inheritance:
Inheritance is a hierarchical model that joins classes and allows and encourages class reuse. It 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 access to 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 objects of different classes 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. Is String the most basic data type?
The basic data types include byte, int, char, long, float, double, boolean, and short.
The java.lang.String class is of type final, so it cannot be inherited or modified. To improve efficiency and save space, we should use the StringBuffer class
3. What's the difference between int and Integer
Java provides two different types: reference type and primitive 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.
Primitive type wrapper class
BooleanBoolean
CharCharacter
ByteByte
ShortShort
IntInteger
LongLong
FloatFloat
DoubleDouble
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.
4. The difference between String and StringBuffer
The JAVA platform provides two classes: String and StringBuffer, which can store and manipulate strings, that is, character data that contains multiple characters. This String class provides a string whose values are immutable. The string provided by this StringBuffer class is modified. You can use StringBuffer when you know that the character data is about to change. Typically, you can use StringBuffers to dynamically construct character data.
5. What are the similarities and differences between runtime exceptions and general exceptions?
The exception indicates the abnormal state that may occur during the running of the program, and the run-time exception represents the exception that may be encountered in the usual operation of the virtual machine, which is a common running error. The java compiler requires methods to declare that non-runtime exceptions may occur, but not to declare that uncaught runtime exceptions must be thrown.
6. State the life cycle of Servlet and the difference between Servlet and CGI.
After Servlet is instantiated by the server, the container runs its init method, runs its service method when the request arrives, and the service method automatically dispatches to run the doXXX method (doGet,doPost) corresponding to the request, and calls its destroy method when the server decides to destroy the instance.
Servlet is different from cgi in that it runs its service method in a multi-threaded way. An instance can serve multiple requests, and its instances are generally not destroyed, while CGI generates a new process for each request and destroys it after the service is completed, so it is less efficient than servlet.
7. Describe the storage performance and characteristics of ArrayList,Vector and LinkedList.
Both ArrayList and Vector use an array to store data. The number of elements in this array is larger than the actual stored data in order to add and insert elements. They both allow elements to be indexed directly by ordinal numbers, but inserting elements involves memory operations such as array element movement, so index data is fast and data insertion is slow. Vector usually performs worse than ArrayList due to the use of synchronized method (thread safety), while LinkedList uses two-way linked lists to achieve storage. Indexing data by ordinal number requires forward or backward traversal, but when inserting data, you only need to record the front and back items of this item, so the insertion speed is faster.
8. What technologies are used to implement EJB? And tell the difference between SessionBean and EntityBean, the difference between StatefulBean and StatelessBean.
EJB includes Session Bean, Entity Bean, Message Driven Bean, based on JNDI, RMI, JAT and other technologies.
SessionBean is used in J2EE applications to perform server-side business operations, such as accessing databases and calling other EJB components. EntityBean is used to represent the data used in the application system.
This is the end of the content of "what are the basic knowledge points of the JAVA programming language". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.