4 - Design Mode - simple factory mode
1, What is a simple factory
1) Simple factory mode belongs to the creation mode, which is a kind of factory mode. The simple factory pattern is that a factory object determines which product class instance to create. Simple factory model is the simplest and most practical model in the factory model family
2) Simple factory pattern: defines a ...
Posted by GoodWill on Sat, 26 Feb 2022 15:07:30 +0100
Java file streaming and I/O
Java file streaming and I/O
file
concept
A file is where data is stored.File stream: files are operated in the form of stream in the program.Stream: the path of data between the data source (file) and the program (memory)Input stream: the path of data from data source (file) to program (memory)Output stream: the path of data from program (me ...
Posted by JamesyBHOY on Sat, 26 Feb 2022 14:10:54 +0100
Distributed transaction solution 2: message queue to achieve final consistency
1. Reliable messaging for ultimate consistency
We have studied the CAP theory before and know that we generally guarantee P and A, abandon C and ensure the final consistency. Distributed transaction The core of using message queue to achieve final consistency is to split distributed transactions into multiple local transactions, and then coord ...
Posted by elflacodepr on Sat, 26 Feb 2022 14:09:51 +0100
Day02: summary of written test questions
catalogue
1, Multiple choice questions
2, Programming problem
1. Sort subsequence
2. Inverted string
1, Multiple choice questions
1.
Resolution:
Both parent class and new subclass objects are allowed
2.
Resolution:
You can see from the source code of String method tolower case
The return value of this method means that if the ...
Posted by phpwannabe25 on Sat, 26 Feb 2022 13:58:35 +0100
Elementary C language - array
catalogue
Creation of one-dimensional array
Initialization of one-dimensional array
Use of one-dimensional array
Storage of one-dimensional array in memory
Creation of two-dimensional array
Initialization of two-dimensional array
Use of two-dimensional arrays
Storage of two-dimensional array in memory
Array out of bounds
Array as fu ...
Posted by spetsacdc on Sat, 26 Feb 2022 13:13:52 +0100
Simulation of wechat red envelope grabbing by double mean method in java
preface
When it comes to robbing red envelopes, you must be very familiar with it, especially wechat robbing red envelopes, which we contact almost every day. Although the amount of red envelopes we grab each time varies from big to small, we are deeply immersed in the happiness of grabbing red envelopes 😄. But then again, I wonder if you gu ...
Posted by Bullit on Sat, 26 Feb 2022 12:27:48 +0100
Multi thread learning Java
Multithreading
1.1 basic concepts: program, process and thread
Program: a set of instructions written in a certain language to complete a specific task. It refers to a piece of static code, static objectProcess: it is an execution process of a program or a running program. It is a dynamic process: it has its own process of emergence, existenc ...
Posted by rizvi on Sat, 26 Feb 2022 12:04:43 +0100
Mr. Cappuccino's 18th cup of coffee -- design mode of gold, silver and four-sided test questions
1. Why do you need to use design patterns?
Using design patterns to reconstruct the whole code can improve the reusability and scalability of the code and reduce code redundancy.
2. Talk about the six principles of design mode?
Open Close Principle: the Open Close Principle is open to extensions and closed to modifications. When the prog ...
Posted by nitediver on Sat, 26 Feb 2022 11:18:56 +0100
java and multithreading concurrency principle learning notes
Blocking queue
Blocking queues are often used in producer consumer scenarios. In java8, JUC provides seven blocking queues.
Class nameeffectArrayBlockingQueueThe bounded blocking queue implemented by the array sorts the elements according to the first in first out (FIFO) principle.LinkedBlockingQueueA bounded blocking queue implemented by a l ...
Posted by Elangler on Sat, 26 Feb 2022 09:20:01 +0100
ArrayList underlying source code
ArrayList underlying source code
conclusion
ArrayList maintains an array of object type elementdata (transient Object[] elementData;)When creating an ArrayList object, if a parameterless constructor is used, the initial elementData capacity is 0. If it is added for the first time, the expanded elementData is 10. If it needs to be expanded aga ...
Posted by Moron on Sat, 26 Feb 2022 09:02:57 +0100