java process control
java process control
1, Scanner object
Basic grammar
Get the input string through the next() and nextLine() methods of the Scanner class. Before reading, we generally need to use hasNext and hasNextLine to judge whether there is still input data
public static void main(String[] args) {
//Create a scanner object to receive keyboard data
...
Added by waldo on Fri, 31 Dec 2021 20:51:53 +0200
JavaSE -- parsing of anonymous objects, inner classes, static inner classes, local classes, and anonymous inner classes
As we all know, the class name of the external top-level class must be the same as the class file name, and only public and default can be used. The internal class refers to defining another class inside the external class. The class name does not need to be the same as the file name. Internal classes can be static, public, default, protected a ...
Added by DChiuch on Fri, 31 Dec 2021 19:27:46 +0200
java multithreading
2, Multithreading
2.1 creation method of multithreading
1) Inherit Thread class
2) Implement the Runable interface
3) Implement Callable interface
/**
* callable Method to create a thread
* Return value
*
* Communication between threads (wait/notify)
*/
public class Test1 {
public static void main(String[] args) {
// //St ...
Added by gergy008 on Fri, 31 Dec 2021 17:42:41 +0200
Java learning notes - basic syntax Ⅷ - generics, Map
generic paradigm
Generic type is essentially a parameterized type, that is, the operated data type is specified as a parameter, that is, the type is parameterized from the original specific type, and then the specific type is passed in during use / call. This parameter type can be used in classes, methods and interfaces, including generic class ...
Added by Atomic Taco on Sun, 26 Dec 2021 15:05:45 +0200
Java process control of Java se
User interaction scanner
Basic knowledge of Scanner
definition
The Scanner scanner can scan the data entered by the user on the console through the Scanner class
Basic grammar
Scanner sc = new Scanner(System.in);
Scanner gets the string entered by the console
Method 1: next() method
example
package com.lan.scanner;
import java.util.S ...
Added by knetcozd on Fri, 24 Dec 2021 18:42:41 +0200
JavaSE advanced multithreading -- thread collaboration
Thread collaboration
Thread communication
Application scenario: producer and consumer issues
Suppose that only one product can be stored in the warehouse, the producer puts the produced products into the warehouse, and the consumer takes the products from the warehouse for consumptionIf there is no product in the warehouse, the producer wi ...
Added by doni49 on Fri, 24 Dec 2021 04:00:15 +0200
Java multithreading (detailed notes)
introduction
It records the concept of multithreading, inheriting Thread, realizing Runnable, Thread sleep, Thread safety problems and solutions, multithread communication problems and Thread pool.
Overview of multithreading technology
Threads and processes
process
It refers to an application running in memory, and each process has an inde ...
Added by MrKaraokeSteve on Thu, 23 Dec 2021 20:31:10 +0200
Java se -- phase 2 4
generic paradigm
1. Benefits of generics
At compile time, check the type of added elements to improve securityWhen the ClassCastException of the runtime is transferred to the compilation time, it becomes a compilation failure.It reduces the number of type conversions and improves efficiency
2. Precautions
1. Interface list, public class Has ...
Added by robot43298 on Thu, 23 Dec 2021 08:53:34 +0200
QR code generation
Making QR code requires introducing google jar
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>3.3.0</version>
</dependency>
QR code generation:
/**
* @param text QR code storage information
* @param width ...
Added by aftabn10 on Thu, 23 Dec 2021 07:50:16 +0200
Java implements a simple login and registration interface based on Swing and JDBC
catalogue
1, Demand analysis
2, Preparatory work
1. Prepare the development environment
2. Prepare the database
3. Prepare for outsourcing
3, Specific steps
1. Open IDEA and create an empty project
2. After completion, import a new module
3. Import the outsourcing jar package to be used by JDBC.
4, Code implementation
1. Inte ...
Added by meir4u on Tue, 21 Dec 2021 14:35:53 +0200