In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 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 knowledge points of Java programming". In daily operation, I believe many people have doubts about what are the basic knowledge points of Java programming. Xiaobian consulted all kinds of information and sorted out simple and easy to use operation methods. I hope to help you answer the doubts about "what are the basic knowledge points of Java programming"! Next, please follow the small series to learn together!
First, understand the four aspects of Java
It is essential to first understand the basic concepts of Java, not to advocate rote memorization, to understand, to understand the differences and connections between them, and what applications are there.
When typing code, don't blindly follow the book, but think about what knowledge points are used in these codes.
Java programming language, i.e. syntax.
Java file format, that is, various folders, file suffixes.
Java Virtual Machine (JVM), an interpreter that processes *.class files.
Java Application Programming Interface (Java API).
Here, Xiaobian built a front-end learning exchange button group: 132667127, the latest front-end information and advanced development tutorials I collated myself, if you want to need it, you can add groups to learn and communicate together.
Second, master static methods and attributes
Static methods and attributes are used to characterize a group of objects rather than individual objects.
Static methods and attributes are heavily used in Java, which is a common trick. But this technique is used infrequently in many languages.
Understanding static methods and attributes is very helpful in understanding the relationship between classes and objects, and they are frequently used in a large number of Java specifications. So students should understand static methods and attributes.
Java is consistent in the invocation of methods and properties, and the difference is only when declared, which is different from C++.
Understand the relationship between Java's three technology platforms
Java is divided into three systems, namely:
1. Java SE (J2SE, Java2 Platform Standard Edition)
2. Java EE (J2EE, Java 2 Platform, Enterprise Edition)
3. Java ME (Java 2 Platform Micro Edition)
Java is divided into two parts: one is compiled and one is run.
Javac: Responsible for the compilation part, when Javac is executed, it will start Java compiler program. Compiles a.Java file with the specified extension. Bytecode files that jvm can recognize are generated. That is, the class file, which is Java's running program.
Java: The part responsible for running. JVM. loads the class libraries required for runtime and executes the class files. A file must have a starting point for execution, and that starting point is the main function.
Master the basic format of Java code
Java comments as comprehensive as possible
Comments on methods should include detailed input parameters and result descriptions, as well as exceptions thrown: class comments should include a description of the class's functionality, author, and modifier.
2. The same variable used many times is best reduced to a constant
Variables with the same value used in multiple places should be reduced to a constant as far as possible to facilitate future maintenance.
3. Perform method calls in loops as little as possible
Try to make fewer avoidable method calls in the loop, which saves method stack creation.
4. The definition of constants can be placed in the interface
In Java, only constants are allowed in interfaces, so putting constants in the interface declaration can omit the public static final keyword.
5. ArrayList and LinkedList selection
This problem is more common. It's usually best for programmers to evaluate the use scenarios for lists and then make choices based on characteristics. ArrayList is implemented using arrays at the bottom, so random reading of data is much faster than LinkedList, while LinkedList is implemented using linked lists, adding and deleting data is much faster than ArrayList.
String,StringBuffer and StringBuilder
This problem is also common. When string concatenation is performed, String usually produces multiple objects and caches multiple values into the constant pool.
7. Selection of packaging and basic types
In the code, if you can use basic data types to do local variable types, try to use basic data types, because basic types of variables are stored in the stack, wrapper variables are in the heap, stack operation speed is much faster than the heap.
8. Assign null to variable references that are no longer used as soon as possible
Doing so will help jvm recycle memory faster. Of course, many people are actually not interested in this practice.
9. Release resources in finally blocks
A typical scenario is when using io streams, which should eventually be closed in finally, regardless of whether an exception occurs.
10. When using an Object as a key in HashMap, pay attention to how to distinguish whether the Objects are the same
In jdk's HashMap implementation, the criteria for determining whether the keys of two Object types are the same are whether the hashcodes are the same and the return value of the equals method. If the business needs to store two memory objects with the same data as different keys in the hashmap, it is necessary to override the hashcode and equals methods.
Java's primary way of describing complex data structures is the collection framework. Java does not have pointers, but describes complex data structures such as arrays and object arrays through a powerful collection framework.
Learning how to describe these data structures is crucial for application programming, especially when it comes to server-side, 3-tier programming.
At this point data can no longer be described in terms of structures such as database result sets. Since many languages do not have such a strong collection framework system, many beginners are at a loss and do not know what to do with it, so it should be given enough attention.
At this point, the study of "what are the basic knowledge points of Java programming" is over, hoping to solve everyone's doubts. Theory and practice can better match to help you learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!
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.