Java中打印图案最常用的25个图案程序

news2024/9/23 21:31:50

Java是公认的最流行的编程语言,因为它的简单性和多功能性。还可以使用它开发各种应用程序,包括Web、移动和桌面应用程序。此外,Java为开发人员提供了强大的工具来轻松高效地创建复杂的程序。Java最有前途的特性之一是它能够创建可以以特定格式打印数字的图案程序。模式程序是学习Java编程的一种很好的方法,特别是对于初学者,因为它有助于理解Java编程的语法和逻辑。

Java模式程序一直是Java面试问题的关键部分之一。它们看起来几乎不可能在某一点上被破解,但这些问题实际上是基于数理逻辑和矩阵的基本原理。因此,Java模式程序非常受欢迎。

这篇Java模式程序文章涵盖了几乎所有可能的模式程序类型,这些程序将使您更好地理解解码模式的逻辑,并能够在面试中构建模式。

如何在Java中打印图案?

在Java中打印模式是编程中的常见任务,尤其是在学习的早期阶段。图案是通过以特定的方式排列符号或数字来形成设计或形状来打印的。这些模式经常用于解决问题,在发展算法思维技能方面也很有用。本文将讨论如何在Java中打印模式,并探索一些最常见的模式。

在Java中打印模式的循环和控制语句是最好的。循环帮助您重复代码块,直到满足特定条件,并且控制语句允许您根据特定条件更改程序流。下面讨论Java中的不同模式:

我们将通过以下摘要处理不同类型的Java模式程序。

Java中的模式程序

星形图案

星形图案是Java中流行的图案程序,通常用于创建有趣的视觉设计或图形。这些程序使用马赛克或其他符号来创建各种形状和图案。星形图案通常用于计算机图形,标志设计和其他视觉显示。

在Java中创建星形图案涉及到使用嵌套循环来控制行数和列数以及星号或其他符号的位置。该程序可以定制以创建图案,包括三角形、正方形、圆形和更复杂的设计。此外,它还可以定制以创建各种图案,如下所述:

Pattern 1

/*Star Pattern 1
* 
* * 
* * * 
* * * * 
* * * * *   */

package tech.besthub;
public class Star {
public static void main(String[] args) {
int rows = 5;
for (int i = 1; i <= rows; ++i) {  //Outer loop for rows
for (int j = 1; j <= i; ++j) { //Inner loop for Col
System.out.print("* "); //Print *
}
System.out.println(); //New line
}
}
}
Pattern 2

/*Star Pattern 2
* * * * * 
* * * * 
* * * 
* * 
*   */

package tech.besthub;
public class Star {
    public static void main(String[] args) {
        int rows = 5;
        for(int i = rows; i >= 1; --i) {  //For Loop for Row 
            for(int j = 1; j <= i; ++j) { //For Loop for Col
                System.out.print("* "); //Prints *
            }
            System.out.println(); //Get to newline
        }
    }
}
Pattern 3

/*Star Pattern 3
* 
* * 
* * * 
* * * * 
* * * * * 
* * * * 
* * * 
* * 
*   */
package tech.besthub;
import java.util.Scanner;
public class Star {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in); //Input
System.out.println("Enter the number of rows: ");
int rows = sc.nextInt();
for (int i = 0; i <= rows - 1; i++) { //For Loop for Row 
for (int j = 0; j <= i; j++) { //For Loop for Col
System.out.print("*" + " "); //prints * and blank space
}
System.out.println(""); // new line
}
for (int i = rows - 1; i >= 0; i--) { //For Loop for Row
for (int j = 0; j <= i - 1; j++) { //For Loop for Col
System.out.print("*" + " "); //prints * and blank space
}
System.out.println("");// new line
}
sc.close();
}
}
Pattern 4

/*Star Pattern 4
           * 
         * * 
       * * * 
     * * * * 
   * * * * *   */
package tech.besthub;
public class Star {
public static void printStars(int n) {
int i, j;
for (i = 0; i < n; i++) {  
for (j = 2 * (n - i); j >= 0; j--) { //For Loop for Row
System.out.print(" "); // Print Spaces
}

for (j = 0; j <= i; j++) { //For Loop for col
System.out.print("* "); // Print Star
}
System.out.println();
}
}

public static void main(String args[]) {
int n = 5; //Number of Rows
printStars(n);
}
}
Pattern 5

/*Star Pattern 5
* * * * *
  * * * *
    * * *
      * *
        *  */
package tech.besthub;
import java.util.Scanner;
public class Star {
public static void main(String[] args) {
Scanner S = new Scanner(System.in); //Input
System.out.println("Enter row value ");
int r = S.nextInt();
for (int i = r; i >= 1; i--) { 
for (int j = r; j > i; j--) { 
System.out.print(" "); // Prints Blank space
}
for (int k = 1; k <= i; k++) {
System.out.print("*"); //Prints *
}
System.out.println(" "); //Prints blank spaces
}
S.close();
}
}
Pattern 6

/*Star Pattern 6
    *
   **
  ***
 ****
*****
 ****
  ***
   **
    *   */
package tech.besthub;
import java.util.Scanner;
public class Star {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the number of rows: ");
int rows = sc.nextInt();
for (int i = 1; i <= rows; i++) {
for (int j = i; j < rows; j++) { //Rows Loop
System.out.print(" "); // Blank Space
}
for (int k = 1; k <= i; k++) { //Cols Loop
System.out.print("*"); // Prints *
}
System.out.println("");
}
for (int i = rows; i >= 1; i--) {
for (int j = i; j <= rows; j++) { //Rows Loop
System.out.print(" ");  // Prints blank spaces
}

for (int k = 1; k < i; k++) { //Col Loop
System.out.print("*");  // Prints *
}
System.out.println(""); // New Line1
}
sc.close();
}
}
Pattern 7

/*Star Pattern 7
    * 
   * * 
  * * * 
 * * * * 
* * * * *    */
package tech.besthub;
public class Star {
public static void printTriagle(int n) {
for (int i = 0; i < n; i++) {
for (int j = n - i; j > 1; j--) { //Loop for blank space
System.out.print(" "); //Print Space
}

for (int j = 0; j <= i; j++) { loop for star
System.out.print("* "); //Print Star
}
System.out.println(); //Newline
}
}

public static void main(String args[]) {
int n = 5;
printTriagle(n);
}
}
Pattern 8

/*Star Pattern 8
 * * * * * 
  * * * * 
   * * * 
    * * 
     *  */

package tech.besthub;
import java.util.Scanner;
public class Star {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the number of rows: ");
int rows = sc.nextInt();
for (int i = 0; i <= rows - 1; i++) { //For loop for Rows
for (int j = 0; j <= i; j++) { //For loop for Col
System.out.print(" "); // blank space
}

for (int k = 0; k <= rows - 1 - i; k++) { 
System.out.print("*" + " "); // prints * and blank space
}
System.out.println(); //Next line
}
sc.close();
}
}
Pattern 9

/*Star Pattern 9
    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *     */

package tech.besthub;
import java.util.Scanner;
public class Star {
public static void main(String args[]) {
int n, x, j, blank = 1;
System.out.print("Enter the value for rows: ");
Scanner s = new Scanner(System.in);
n = s.nextInt(); //input
blank = n - 1; // logic for balck spaces 
//Upper star Pyramid
for (j = 1; j <= n; j++) {
for (x = 1; x <= blank; x++) {
System.out.print(" "); //print blank space
}
blank--;
for (x = 1; x <= 2 * j - 1; x++) {
System.out.print("*"); //Print Star
}
System.out.println("");
}
//Lower star Pyramid
blank = 1;
for (j = 1; j <= n - 1; j++) {
for (x = 1; x <= blank; x++) {
System.out.print(" "); //Print Spaces
}
blank++;
for (x = 1; x <= 2 * (n - j) - 1; x++) {
System.out.print("*"); //Print Star
}
System.out.println(""); //Print new line
}
}
}
Pattern 10

/*Star Pattern 10
* * * * * 
 * * * * 
  * * * 
   * * 
    * 
    * 
   * * 
  * * * 
 * * * * 
* * * * *   */

package tech.besthub;
import java.util.Scanner;
public class Star {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the number of rows: ");
int rows = sc.nextInt(); //Input
//Upper Inverted Pyramid
for (int i = 0; i <= rows - 1; i++) {
for (int j = 0; j < i; j++) {
System.out.print(" "); Print blank space
}
for (int k = i; k <= rows - 1; k++) {
System.out.print("*" + " "); //Print star and blank space
}
System.out.println(""); //New line
}
//For lower Pyramid
for (int i = rows - 1; i >= 0; i--) {
for (int j = 0; j < i; j++) {
System.out.print(" "); //Print spaces
}
for (int k = i; k <= rows - 1; k++) {
System.out.print("*" + " "); //Print Star and Space
}
System.out.println(""); //Print New line
}
sc.close();
}
}
Pattern 11

/*Diagonal 11
        *
      *
    *
  *
*             */

package tech.besthub;
public class Star {
public static void main(String[] args) {
int i, j;
for (i = 1; i <= 5; i++) {
for (j = 0; j < 5 - i; j++) {
System.out.print("  "); //Print blank space
}
System.out.print("*"); //Print Star and newline
}
}
}

X图案

它创建了X个字符的对角线模式。可以使用嵌套循环创建该模式,该循环根据行号和列号在特定位置打印X个字符。

Pattern 12

/*X Pattern 12
*     *
 *   *
  * *
   *
  * *
 *   *
*     *  */
package tech.besthub;
import java.util.*;
public class Star {
public static void main(String args[]) {
int i, j, n;
Scanner sc = new Scanner(System.in);
System.out.println("Enter a value for n");
n = sc.nextInt(); //Input
//Upper V pattern
for (i = n; i >= 1; i--) {
for (j = i; j < n; j++) {
System.out.print(" ");//print spaces
}

for (j = 1; j <= (2 * i - 1); j++) {
if (j == 1 || j == (2 * i - 1))//Logic for printing star
System.out.print("*");
else
System.out.print(" ");//if logic fails print space
}
System.out.println("");
}

//Lower Inverted V pattern
for (i = 2; i <= n; i++) {
for (j = i; j < n; j++) {
System.out.print(" ");//Print spaces
}

for (j = 1; j <= (2 * i - 1); j++) {
if (j == 1 || j == (2 * i - 1))//Logic for printing star
System.out.print("*");
else
System.out.print(" ");//if logic fails print space
}
System.out.println("");
}
}
}
Pattern 13

/*Inverted V 13
    *     
   * *    
  *   *   
 *     *  
*       *   */
package tech.besthub;
import java.util.Scanner;
public class Star {
public static void main(String[] args) {
Scanner cs = new Scanner(System.in); //Input
System.out.println("Enter the row size:");
int out, in;
int row_size = cs.nextInt();
int print_control_x = row_size;
int print_control_y = row_size;
for (out = 1; out <= row_size; out++) {
for (in = 1; in <= row_size * 2; in++) {
if (in == print_control_x || in == print_control_y) {
System.out.print("*");
} else {
System.out.print(" ");
}
}
print_control_x--;
print_control_y++;
System.out.println();
}
cs.close();
}
}
Pattern 14

/* V-pattern
*       *
 *     *
  *   *
   * *
    *     */

package tech.besthub;
public class Star {
static void pattern(int n) {
int i, j;
for (i = n - 1; i >= 0; i--) {
for (j = n - 1; j > i; j--) {
System.out.print(" "); //Print Space
}
System.out.print("*"); //Print star
for (j = 1; j < (i * 2); j++)
System.out.print(" ");//Print space
if (i >= 1)
System.out.print("*");
System.out.print("");//Enter newline
}
}

public static void main(String args[]) {
int n = 5;
pattern(n); //Pattern method call
}
}
Pattern 15

/*Rombus 15
    *
   * *
  *   *
 *     *
*       *
 *     *
  *   *
   * *
    *     */
package tech.besthub;
import java.util.Scanner;
public class Star {
public static void main(String[] args) {
System.out.println("Number of rows: ");
int rows = extracted().nextInt();
int i;
//upper inverted V pattern
for (i = 1; i <= rows; i++) {
for (int j = rows; j > i; j--) {
System.out.print(" "); //Print spaces
}
System.out.print("*"); //Print Spaces
for (int k = 1; k < 2 * (i - 1); k++) { /Logic for pattern
System.out.print(" "); //Print Spaces
}
if (i == 1) {
System.out.println(""); //Condition true, go to newline
} else {
System.out.println("*"); //else print star
}
}

//Lower v pattern
for (i = rows - 1; i >= 1; i--) {
for (int j = rows; j > i; j--) {
System.out.print(" "); //Print Spaces
}
System.out.print("*");
for (int k = 1; k < 2 * (i - 1); k++) { Logic for pattern
System.out.print(" ");
}

if (i == 1)
System.out.println(""); //newline
else
System.out.println("*"); //Print star
}
}

private static Scanner extracted() {
return new Scanner(System.in);
}
}
Pattern 16

/*Star Pattern 16
    *
   * *
  *   *
 *     *
*********   */
package tech.besthub;
import java.util.Scanner;
public class Star {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the number of rows: ");
int rows = sc.nextInt();
for (int i = 1; i <= rows; i++) {
for (int j = i; j < rows; j++) {
System.out.print(" ");
}
for (int k = 1; k <= (2 * i - 1); k++) {
if (k == 1 || i == rows || k == (2 * i - 1)) {
//Logic for printing Pattern
System.out.print("*"); //Print Star
} else {
System.out.print(" ");  //Print Spaces
}
}
System.out.println("");
}
sc.close();
}
}
Pattern 17

/*Star Pattern 17
*********
 *     *
  *   *
   * *
    *      */
package tech.besthub;
import java.util.Scanner;
public class Star {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the number of rows: ");
int rows = sc.nextInt(); //Row input
for (int i = rows; i >= 1; i--) {
for (int j = i; j < rows; j++) {
System.out.print(" "); //Print Spaces
}
for (int k = 1; k <= (2 * i - 1); k++) {
if (k == 1 || i == rows || k == (2 * i - 1)) { //logic to print Pattern
System.out.print("*"); //Ture prints star
} else {
System.out.print(" "); //False prints spaces
}
}
System.out.println("");
}
sc.close();
}
}
Pattern 18

/*Box 18
**********
*        *
*        *
*        *
*        *
*        *
*        *
*        *
*        *
**********  */
package tech.besthub;
public class Star {
static void print_rectangle(int n, int m) {
int i, j;
for (i = 1; i <= n; i++) {
for (j = 1; j <= m; j++) {
if (i == 1 || i == n || j == 1 || j == m) //Logic to print 
System.out.print("*"); //Tue?, print star
else
System.out.print(" "); //Tue?, print space
}
System.out.println();
}
}
public static void main(String args[]) {
int rows = 10, columns = 10;
print_rectangle(rows, columns); //Method call
}
}
Pattern 19

/*
1 
1 2 
1 2 3 
1 2 3 4 
1 2 3 4 5 */ 
package tech.besthub;
import java.util.Scanner;
public class Star {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in); //Input
System.out.println("Number of rows: ");
int rows = sc.nextInt(); 
for (int i = 1; i <= rows; i++) {
for (int j = 1; j <= i; j++) {
System.out.print(j + " "); //Print j value and space
}
System.out.println();
}
sc.close();
}
}

弗洛伊德三角图案

这种模式是通过打印一个数字三角形来创建的,从1开始,每行的值递增1。但是,数字是按特定顺序打印的,如下例所示:

Pattern 20

/*Number Pattern 20 (Floyd's Triangle)
1 
2 3 
4 5 6 
7 8 9 10 
11 12 13 14 15  */
package tech.besthub;
public class Star {
public static void main(String[] args) {
int i, j, k = 1;
for (i = 1; i <= 5; i++) {
for (j = 1; j < i + 1; j++) {
System.out.print(k++ + " "); /Floyd’s triangle logic(prints K value and increments on every iteration)
}
System.out.println();
}
}
}

帕斯卡三角

它涉及到创建遵循特定数学规则的数字的三角形模式。可以使用嵌套循环创建该模式,该循环根据每个数字在三角形中的位置计算每个数字的值。

Pattern 21

/*Number Pattern 21 (Pascal's Triangle)
               1
             1   1
           1   2   1
         1   3   3   1
       1   4   6   4   1
     1   5  10  10   5   1 */
package tech.besthub;
public class Star {
public static void main(String[] args) {
int x = 6;
for (int i = 0; i < x; i++) {
int num = 1;
System.out.printf("%" + (x - i) * 2 + "s", ""); //Pascals triangle logic
for (int j = 0; j <= i; j++) {
System.out.printf("%4d", num);
num = num * (i - j) / (j + 1);
}
System.out.println();
}
}
}

数字图案

它是另一种类型的Java模式程序,涉及以特定的顺序或排列打印数字。这些程序可用于创建表格、图形和其他类型的可视显示。

在Java中,创建数字模式涉及使用循环来控制行数和列数以及打印的数字值。该程序可以定制以创建模式,包括乘法表,斐波那契序列和更复杂的设计。

Pattern 22

/*Number Pattern 22
10101
01010
10101
01010
10101  */
package tech.besthub;
import java.util.Scanner;
public class Star {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Number of rows: ");
int rows = sc.nextInt(); //Input
for (int i = 1; i <= rows; i++) {
int num;
if (i % 2 == 0) {
num = 0;
for (int j = 1; j <= rows; j++) {
System.out.print(num);
num = (num == 0) ? 1 : 0;
}
} else {
num = 1;
for (int j = 1; j <= rows; j++) {
System.out.print(num);
num = (num == 0) ? 1 : 0;
}
}
System.out.println();
}
sc.close();
}
}
Pattern 23

/*Ruby Pattern 23
   A
  B B
 C   C
D     D
 C   C
  B B
   A     */
package tech.besthub;
import java.util.Scanner;
public class Ruby {
public static void main(String[] args) {
char[] alpha = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
int digit = 0;
String[] ruby = new String[26];
System.out.print("Input Uppercase alphabet between A to Z:");
Scanner reader = new Scanner(System.in);
try {
char aplhabet = reader.next("[A-Z]").charAt(0);
for (int i = 0; i < alpha.length; i++) {
if (alpha[i] == aplhabet) {
digit = i;
break;
}
}
for (int i = 0; i <= digit; i++) {
ruby[i] = "";
for (int p = 0; p < digit - i; p++) {
ruby[i] += " ";
}
ruby[i] += alpha[i];
if (alpha[i] != 'A') {
for (int p = 0; p < 2 * i - 1; p++) {
ruby[i] += " ";
}
ruby[i] += alpha[i];
}
System.out.println(ruby[i]);
}
for (int i = digit - 1; i >= 0; i--) {
System.out.println(ruby[i]);
}
} catch (Exception e) { //Exception
e.printStackTrace();
} finally {
reader.close();
}
}
}
Pattern 24

/*Alphabet Pattern 24
A 
A B 
A B C 
A B C D 
A B C D E 
A B C D E F   */
package tech.besthub;
public class Alphabet {
public static void main(String[] args) {
int alphabet = 65; //ASCII value of “A”
for (int i = 0; i <= 5; i++) {
for (int j = 0; j <= i; j++) {
System.out.print((char) (alphabet + j) + " "); //Logic to print Alphabet pattern
}
System.out.println();
}
}
}
Pattern 25

/*Alphabet Pattern 25
    A 
   A B 
  A B C 
 A B C D 
A B C D E  */
package tech.besthub;
public class Alphabet {
public static void main(String[] args) {
for (int i = 0; i <= 4; i++) {
int alphabet = 65; //ASCII value of “A”
for (int j = 4; j > i; j--) {
System.out.print(" "); //Print Space
}
for (int k = 0; k <= i; k++) {
System.out.print((char) (alphabet + k) + " "); //Print Alphabet
}
System.out.println();
}
}
}

技术交流

一个人走的很快,一群人走的更远。

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1397833.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

爬虫-selenium自动化(3)-验证码

#验证码分很多种&#xff0c;奇葩也无处不在:哪个是真茅台&#xff0c;红绿灯&#xff0c;摩托车......(我是个人都看不出来) (๑﹏๑) #本节内容为selenium自动化实现验证码通过-------字符验证码&#xff0c;点触验证码。 验证码介绍 字符验证码案例 点触验证码案例

[Python] scikit-learn之mean_squared_error函数(Mean Squared Error(MSE))介绍和使用案例

什么是均方误差(MSE)和均方根误差(RMSE)? MSE 是均方误差(Mean Squared Error)的缩写&#xff0c;是一种常用的衡量回归模型预测精度的指标。它表示预测值与真实值之间差异的平方和的平均值&#xff0c;通常用于评估回归模型的性能。 RMSE 是均方根误差(Root Mean Squared Er…

C#,字符串匹配(模式搜索)有限自动机(Finite Automata)算法的源代码

一、有限状态自动机 图中两个圆圈&#xff0c;也叫节点&#xff0c;用于表示状态&#xff0c;从图中可以看成&#xff0c;它有两个状态&#xff0c;分别叫0和1。从每个节点出发&#xff0c;都会有若干条边。当处于某个状态时&#xff0c;如果输入的字符跟该节点出发的某条边的内…

tomcat与servlet

目录 一、Http服务器 二、tomcat 1、概念 2、tomcat解压缩文件 &#xff08;1&#xff09;bin文件夹 &#xff08;2&#xff09;conf文件夹 &#xff08;3&#xff09;logs &#xff08;4&#xff09;webapps 3、借助tomcat服务器访问网页 三、servlet 1、概念 2、s…

阿里云有哪些优势?为什么选择阿里云?

为什么选择阿里云&#xff1f;阿里云服务器有哪些优势&#xff1f;阿里云全球第三&#xff0c;国内第一云&#xff0c;阿里云服务器网aliyunfuwuqi.com分享云服务器ECS在丰富ECS实例架构、弹性灵活、稳定可靠、便捷易用、安全保障和成本优化多方面优势&#xff1a; 阿里云服务…

【Linux】磁盘结构 | 文件系统 | 软硬链接

文件的状态有被打开和没有被打开&#xff0c;之前谈到一个文件被进行读写&#xff0c;就要打开加载到内存中&#xff0c;通过对应的系统调用&#xff0c;fd文件描述符的管理&#xff0c;write和read等函数的增删查改。并且借助缓冲区对文件属性和内容的修改。 大部分文件是没有…

高级架构师是如何设计一个系统的?

架构师如何设计系统&#xff1f; 系统拆分 通过DDD领域模型&#xff0c;对服务进行拆分&#xff0c;将一个系统拆分为多个子系统&#xff0c;做成SpringCloud的微服务。微服务设计时要尽可能做到少扇出&#xff0c;多扇入&#xff0c;根据服务器的承载&#xff0c;进行客户端负…

HFSS实战(一)——仿真PCB微带线的损耗

文章目录 一、ODB文件的导出二、PCB文件导入2.1 pcb文件导入2.2层叠设置 三、模型的裁剪四、模型的简化五、端口设置六、将3D LAYOUT模型导出成HFSS模型七、HFSS仿真结束 主要学习目标&#xff1a;利用HFSS3D layout 完成微带线的电磁仿真 利用一个简单的仿真&#xff0c;完成…

项目实战————苍穹外卖(DAY11)

苍穹外卖-day11 课程内容 Apache ECharts 营业额统计 用户统计 订单统计 销量排名Top10 功能实现&#xff1a;数据统计 数据统计效果图&#xff1a; 1. Apache ECharts 1.1 介绍 Apache ECharts 是一款基于 Javascript 的数据可视化图表库&#xff0c;提供直观&#x…

2023.1.19 关于 Redis 事务详解

目录 Redis 事务对比 MySQL 事务 MySQL 事务 Redis 事务 Redis 事务原子性解释 Redis 事务详解 执行流程 典型使用场景 Redis 事务命令 WATCH 的使用 WATCH 实现原理 总结 阅读下文之前建议点击下方链接了解 MySQL 事务详解 MySQL 事务详解 Redis 事务对比 MySQL 事…

探索设计模式的魅力:一篇文章让你彻底搞懂建造者模式

建造者模式&#xff08;Builder Pattern&#xff09;是一种创建型设计模式&#xff0c;旨在将一个复杂对象的创建过程与其表示分离&#xff0c;使得同样的构建过程可以创建不同的表示形式。 主要角色&#xff1a; 产品&#xff08;Product&#xff09;&#xff1a;表示正在构建…

小程序系列--9.生命周期

1. 什么是生命周期&#xff1f; 2. 生命周期的分类 3. 什么是生命周期函数 4. 生命周期函数的分类 5. 应用的生命周期函数 6. 页面的生命周期函数

SpringCloud Aliba-Sentinel【中篇】-从入门到学废【5】

目录 1.流控规则 2. 熔断规则 3.热点规则 1.流控规则 1.资源名&#xff1a;唯一名称&#xff0c;默认请求路径 2.针对来源: Sentinel可以针对调用者进行限流,填写微服务名,默认default (不区分来源) 3.阈值类型/单机阈值&#xff1a; QPS&#xff08;每秒钟的请求数量&…

pytorch学习(一)线性模型

文章目录 线性模型pytorch使用sklearn训练 pytorch是一个基础的python的科学计算库&#xff0c;它有以下特点&#xff1a; 类似于numpy&#xff0c;但是它可以使用GPU可以用它来定义深度学习模型&#xff0c;可以灵活的进行深度学习模型的训练和使用 线性模型 线性模型的基本形…

Studio One2024免费版下载及入门教程分享

众所周知&#xff0c;Studio One是一个专业的音频编辑软件&#xff0c;近几年随着音视频剪辑越来越火&#xff0c;Studio One也逐渐被人们所熟知。最近&#xff0c;就有许多小伙伴私信我&#xff0c;寻求Studio One的入门教程。 这不&#xff0c;今天小编就给大家带来了音频剪…

iphone5s基带部分电源部分主主电源供电及

时序: 1.,基带电源的供电&#xff0c;基带电源也叫pmu。 首先时序图说电池提供供电&#xff0c;电池是J6接口&#xff0c;视频习惯把接口称之为座子。查U2_RF芯片&#xff0c;发现供电信号为PP_BATT_VCC_CONN&#xff0c;但是没查到跟电池座子有关系&#xff0c;电池座子写的是…

Flask框架小程序后端分离开发学习笔记《1》网络知识

Flask框架小程序后端分离开发学习笔记《1》网络知识 Flask是使用python的后端&#xff0c;由于小程序需要后端开发&#xff0c;遂学习一下后端开发。 一、网址组成介绍 协议&#xff1a;http&#xff0c;https (https是加密的http)主机&#xff1a;g.cn zhihu.com之类的网址…

Python使用pyechart分析疫情确诊人数图(2024)

import json from pyecharts.charts import Map from pyecharts import options as opts# 首先打开文件获取数据 f open("/Desktop/python/Project/数据可视化/疫情.txt", "r", encoding"UTF-8") data f.read()# 字符串转化成json数据 data_js…

rust使用protobuf

前言 c,java,go 等直接是用 &#xff0c;具体就不说了&#xff0c;这章主要讲述rust 使用protobuf 这章主要讲述2种 1 > protoc protoc-gen-rust plugin 2> protoc prost-build 1&#xff1a;环境 win10 rustrover64 25-2 下载地址 https://github.com/protocolbu…

CHS_01.2.2.1+调度的概念、层次

CHS_01.2.2.1调度的概念、层次 调度的概念、层次知识总览调度的基本概念调度的三个层次——高级调度![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/6957fdec179841f69a0508914145da36.png)调度的三个层次——低级调度调度的三个层次——中级调度补充知识&#xff…