Explain Java reflection mechanism in detail
Explain Java reflection mechanism in detail
Experience the benefits of reflection through cases
case
US group take away - > payment - either paid with WeChat or paid by Alipay.
//Interface maker: meituan takeout
public interface Mtwm {
//Online payment function:
void payOnline();
}
public class WeChat implements Mtwm{
@ ...
Posted by mrdonrule on Sun, 23 Jan 2022 06:45:01 +0100
Java -- dead loop caused by HashMap in high concurrency
Basic implementation of HashMap (before JDK 8)
HashMap usually uses a pointer array (assumed to be table []) to disperse all keys. When a key is added, it will calculate the subscript i of the array through the key through the Hash algorithm, and then insert this into table[i]. If two different keys are counted in the same I, it is called conf ...
Posted by skyriders on Sat, 22 Jan 2022 17:37:34 +0100
Deep understanding of sleep() and wait()
preface
sleep method and wait method are two very confusing concepts, which are often asked. This paper introduces the characteristics of the two methods and the differences between the two methods, which is helpful for us to understand and distinguish.
1, sleep()
The sleep() method is a method in the Thread class. Calling this metho ...
Posted by bostonmacosx on Sat, 22 Jan 2022 14:21:48 +0100
Java - multithreading notes
Basic concepts of operating system (Master)
example:
The program keeps outputting a greeting on the screen(Like "hello")
"At the same time, when I input fixed input through the keyboard, the program stops outputting greetings to the screen(For example, input gun)
Single thread
package com.cskaoyan._01introduction;
import java.ut ...
Posted by kaveman50 on Sat, 22 Jan 2022 09:02:14 +0100
JAVA foundation - Common API I
Common API
1. Scanner class
1.1 what is the Scanner class
A simple text scanner that can parse basic types and strings. For example, the following code enables the user to download from system Read a number in:
Scanner sc = new Scanner(System.in);
int i = sc.nextInt();
Remarks: system In system input refers to entering data through the ke ...
Posted by bailo81 on Fri, 21 Jan 2022 23:07:32 +0100
Spring IOC principle and injection
1. Spring framework overview
1. Spring is a lightweight open source Java EE framework 2. Spring can solve the complexity of enterprise application development 3. Spring has two core parts: IOC and Aop (1) IOC: inversion of control, leaving the process of creating objects to Spring for management (2) Aop: aspect oriented, without modifying ...
Posted by rebelo on Thu, 20 Jan 2022 21:04:56 +0100
Comprehensive explanation of Java multithreading and multi case
This chapter mainly clarifies multithreading
Processes and threads
Process is the unit of system resource allocation, and thread is the unit of CPU scheduling and execution
There are three ways to create threads
Inherit Thread class (not recommended to avoid the limitation of OOP single inheritance)
The custom Thread class inherits t ...
Posted by poison on Tue, 18 Jan 2022 19:54:38 +0100
Summary of common Java classes
Object
Object class is the parent class of all classes, that is, all classes in Java inherit object by default, and subclasses can use all methods of object.
public class Test {
}
amount to
public class Test extends Object {
}
The Object class is the root of the class hierarchy. The Object class is the only class in Java that does ...
Posted by millsy007 on Sun, 16 Jan 2022 14:23:22 +0100
java exception handling
Chapter VI: exception handling one
1. Overview of anomalies one
1.1 introduction of abnormality one
1.2 concept of abnormality two
2. Anomaly classification three
2.1 abnormal system three
2.2 Throwable......................................................................................................................... 3
2.3 error fou ...
Posted by PW on Thu, 13 Jan 2022 16:43:42 +0100
I learned packaging when my roommate went to the bathroom?
Blog home page Xiao Wu_ Xiao Wu has an idea_ CSDN blog - notes, leetcode,java domain Blogger Welcome to pay attentiongive the thumbs-upCollection and message Heaven rewards diligence. Diligence can make up for weakness. Come on with Xiao Wu Freshmen, the level is limited, please give advice, thank you very much! 🍊 Here's ...
Posted by alex.saidani on Thu, 06 Jan 2022 14:27:59 +0100