[Java foundation] 09 "common API
API overview
API concept
API(Application Programming Interface): application programming interface
Also known as: help documents
To write a robot program to control the robot to play football, the program needs to send all kinds of commands to the robot, such as running forward, running backward, sh ...
Posted by akrocks_extreme on Tue, 04 Feb 2020 03:05:12 -0800
Personal notes for learning Java enumeration and annotations
1. Enumeration
public class TestSeason {
public static void main(String[] args) {
Season spring = Season.SPRING;
System.out.println(spring);
spring.show();
System.out.println(spring.getSeasonName());
}
}
//Enum Class
class Season{
//1. Provide the properties of the class and declare it private final
private final ...
Posted by mwalsh on Sun, 02 Feb 2020 10:34:17 -0800
The implementation principle and Vector of ArrayList
The core point of the underlying implementation of ArrayList
1. The collection bottom layer is implemented by using array
2. Why can a set store infinite size? ####The implementation of array expansion technology
Arrays.copyOf:
To copy the array, return the copied array. Parameters are the copied arr ...
Posted by icyfire624 on Sat, 01 Feb 2020 23:25:32 -0800
SPI (Service Provider interface) mechanism
1, Loading mechanism of class
The loader loading of classes in Java comes from files, networks, source files, etc. By default, the class loader of the jvm uses the parent delegation mechanism, Bootstrap ClassLoader, Extension ClassLoader, and attachment classloader (system classloader). Each class l ...
Posted by xXx_Hobbes_xXx on Sat, 01 Feb 2020 09:01:24 -0800
java part enumeration
After JDK 1.5, enum types can be defined with the help of enum keyword. The syntax structure is as follows:
[public] enum enumeration name [implements interface list]{
Enumerating object 1 [, enumerating object 2] [etc ];
[member variable 1;]
[member variable 2;]
[...]
[(static or non static) code block]
[constructi ...
Posted by krio on Fri, 31 Jan 2020 18:38:49 -0800
Sword finger Offer reply flow series - rebuild binary tree
Interview question 6: reconstruction of binary tree
Title Description:
Enter the results of the preorder traversal and inorder traversal of a binary tree, and rebuild the binary tree. It is assumed that the results of the input preorder traversal and preorder traversal do not contain duplicate numbers. For example, input the sequence {1,2,4,7,3 ...
Posted by tsabar on Fri, 31 Jan 2020 16:42:01 -0800
java reflection mode
Reflection pattern optimization of factory class with a large number of switch branches
Continue with the case of factory pattern. In the previous article, there were only two algorithm classes (addition and subtraction). Now add another multiplication
Step one:
//Arithmetic class
public class Operation {
private double _numberA=0;
...
Posted by gnetcon on Fri, 31 Jan 2020 14:11:55 -0800
Java share notes: Custom enumeration class & use enum keyword to define enumeration class
Before JDK 1.5, there was no enum keyword. If you want to use enumeration classes, programmers need to design them according to the rules of Java language. Starting from JDK 1.5, the Java language has added enum keyword, through which enumeration classes can be easily defined. This enumeration class has its own programming rules, and has some s ...
Posted by zaki on Fri, 31 Jan 2020 01:53:02 -0800
Maven modifies the default jdk13 version information to solve the problem of too low JDK version
The default jdk of Maven is version 1.5. It is too cumbersome to modify the jdk version again every time you create a new project, so the following methods can modify the default jdk version of Maven.
Note: it's better to update Maven's version. The setting.xml jdk13 configuration is invalid when I use ...
Posted by lynwell07 on Thu, 30 Jan 2020 06:56:20 -0800
Atomic Operation Classes in JUC and Their Principles
Yesterday we looked briefly at the use of Unsafe. Today we look at how atoms in JUC use Unsafe and how they work!
1. Simple use of AtomicLong
Also remember that in the last blog we used the volatile keyword to modify a variable of type int, and then two threads did 10,000 + 1 operations on the variable, and the result wasn't 20,000. Now when ...
Posted by ckuipers on Wed, 29 Jan 2020 09:46:39 -0800