From c9b9a8108492c026c026fbfd4cb429acbe5d40f4 Mon Sep 17 00:00:00 2001
From: cai-zongzhen <2404985661@qq.com>
Date: Tue, 5 Jan 2021 20:14:07 +0800
Subject: [PATCH] first commit
---
.../Demo01.java" | 26 ++++++++++
.../Demo02.java" | 35 ++++++++++++++
.../Demo03.java" | 47 +++++++++++++++++++
.../Demo01.java" | 26 ++++++++++
.../Demo02.java" | 35 ++++++++++++++
.../Demo03.java" | 47 +++++++++++++++++++
6 files changed, 216 insertions(+)
create mode 100644 "java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\350\224\241\345\256\227\351\225\207/Demo01.java"
create mode 100644 "java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\350\224\241\345\256\227\351\225\207/Demo02.java"
create mode 100644 "java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\350\224\241\345\256\227\351\225\207/Demo03.java"
create mode 100644 "java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\351\231\210\350\203\234\346\235\260/Demo01.java"
create mode 100644 "java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\351\231\210\350\203\234\346\235\260/Demo02.java"
create mode 100644 "java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\351\231\210\350\203\234\346\235\260/Demo03.java"
diff --git "a/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\350\224\241\345\256\227\351\225\207/Demo01.java" "b/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\350\224\241\345\256\227\351\225\207/Demo01.java"
new file mode 100644
index 0000000..2cbdb8a
--- /dev/null
+++ "b/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\350\224\241\345\256\227\351\225\207/Demo01.java"
@@ -0,0 +1,26 @@
+package lession;
+
+import java.util.Scanner;
+
+public class Demo01 {
+
+ public static void main(String[] args) {
+
+ Scanner scanner =new Scanner(System.in);
+ System.out.println("请输入n的值");
+ int n=scanner.nextInt();
+ System.out.println("请再输入m的值");
+ int m=scanner.nextInt();
+ System.out.println("最终结果为:"+num(n,m));
+
+ }
+
+ public static int num(int n, int m) {
+ int sum=1;
+ for (int i = 1; i <=n; i++) {
+ sum*=m;
+ }
+ return sum;
+ }
+
+}
diff --git "a/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\350\224\241\345\256\227\351\225\207/Demo02.java" "b/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\350\224\241\345\256\227\351\225\207/Demo02.java"
new file mode 100644
index 0000000..275a4ad
--- /dev/null
+++ "b/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\350\224\241\345\256\227\351\225\207/Demo02.java"
@@ -0,0 +1,35 @@
+package lession;
+
+import java.util.Random;
+import java.util.Scanner;
+
+public class Demo02 {
+
+ public static void main(String[] args) {
+ Scanner scanner =new Scanner(System.in);
+ Random random =new Random();
+ int a[]=new int[20];
+ for (int i = 0; i < 20; i++) {
+ a[i]=random.nextInt(10)+1;
+ }
+ System.out.println("请输入一个值");
+ int b=scanner.nextInt();
+ System.out.println("出现了:"+num(b,a));
+
+ }
+
+ public static int num(int d,int[] a) {
+ int c;
+ int sum=0;
+ for (int i = 0; i < 20; i++) {
+ c=a[i];
+ System.out.print(c+"\t");
+ if (c==d) {
+ sum++;
+ }
+ }
+ System.out.println();
+ return sum;
+ }
+
+}
diff --git "a/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\350\224\241\345\256\227\351\225\207/Demo03.java" "b/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\350\224\241\345\256\227\351\225\207/Demo03.java"
new file mode 100644
index 0000000..54f6c78
--- /dev/null
+++ "b/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\350\224\241\345\256\227\351\225\207/Demo03.java"
@@ -0,0 +1,47 @@
+package lession;
+
+import java.util.Random;
+
+public class Demo03 {
+
+ public static void main(String[] args) {
+ ;
+ Random random =new Random();
+ int a[]=new int[10];
+ System.out.println("改变前");
+ for (int i = 0; i < 10; i++) {
+ a[i]=random.nextInt(100)+1;
+ System.out.print(a[i]+"\t");
+ }
+ int max=a[0];
+ int min=a[0];
+ for (int i = 1; i < 10; i++) {
+ if (maxa[i]) {
+ min=a[i];
+ }
+ }
+ System.out.println();
+ num(max,min,a);
+}
+
+ public static void num(int max, int min,int[]a) {
+ int d;
+ d=a[0];
+ a[0]=max;
+ max=d;
+ int g;
+ g=a[9];
+ a[9]=min;
+ min=g;
+ System.out.println("改变后");
+ for (int i = 0; i < 10; i++) {
+ System.out.print(a[i]+"\t");
+ }
+
+ }
+}
\ No newline at end of file
diff --git "a/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\351\231\210\350\203\234\346\235\260/Demo01.java" "b/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\351\231\210\350\203\234\346\235\260/Demo01.java"
new file mode 100644
index 0000000..2cbdb8a
--- /dev/null
+++ "b/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\351\231\210\350\203\234\346\235\260/Demo01.java"
@@ -0,0 +1,26 @@
+package lession;
+
+import java.util.Scanner;
+
+public class Demo01 {
+
+ public static void main(String[] args) {
+
+ Scanner scanner =new Scanner(System.in);
+ System.out.println("请输入n的值");
+ int n=scanner.nextInt();
+ System.out.println("请再输入m的值");
+ int m=scanner.nextInt();
+ System.out.println("最终结果为:"+num(n,m));
+
+ }
+
+ public static int num(int n, int m) {
+ int sum=1;
+ for (int i = 1; i <=n; i++) {
+ sum*=m;
+ }
+ return sum;
+ }
+
+}
diff --git "a/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\351\231\210\350\203\234\346\235\260/Demo02.java" "b/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\351\231\210\350\203\234\346\235\260/Demo02.java"
new file mode 100644
index 0000000..275a4ad
--- /dev/null
+++ "b/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\351\231\210\350\203\234\346\235\260/Demo02.java"
@@ -0,0 +1,35 @@
+package lession;
+
+import java.util.Random;
+import java.util.Scanner;
+
+public class Demo02 {
+
+ public static void main(String[] args) {
+ Scanner scanner =new Scanner(System.in);
+ Random random =new Random();
+ int a[]=new int[20];
+ for (int i = 0; i < 20; i++) {
+ a[i]=random.nextInt(10)+1;
+ }
+ System.out.println("请输入一个值");
+ int b=scanner.nextInt();
+ System.out.println("出现了:"+num(b,a));
+
+ }
+
+ public static int num(int d,int[] a) {
+ int c;
+ int sum=0;
+ for (int i = 0; i < 20; i++) {
+ c=a[i];
+ System.out.print(c+"\t");
+ if (c==d) {
+ sum++;
+ }
+ }
+ System.out.println();
+ return sum;
+ }
+
+}
diff --git "a/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\351\231\210\350\203\234\346\235\260/Demo03.java" "b/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\351\231\210\350\203\234\346\235\260/Demo03.java"
new file mode 100644
index 0000000..54f6c78
--- /dev/null
+++ "b/java\347\254\254\345\215\201\346\254\241\344\275\234\344\270\232/\351\231\210\350\203\234\346\235\260/Demo03.java"
@@ -0,0 +1,47 @@
+package lession;
+
+import java.util.Random;
+
+public class Demo03 {
+
+ public static void main(String[] args) {
+ ;
+ Random random =new Random();
+ int a[]=new int[10];
+ System.out.println("改变前");
+ for (int i = 0; i < 10; i++) {
+ a[i]=random.nextInt(100)+1;
+ System.out.print(a[i]+"\t");
+ }
+ int max=a[0];
+ int min=a[0];
+ for (int i = 1; i < 10; i++) {
+ if (maxa[i]) {
+ min=a[i];
+ }
+ }
+ System.out.println();
+ num(max,min,a);
+}
+
+ public static void num(int max, int min,int[]a) {
+ int d;
+ d=a[0];
+ a[0]=max;
+ max=d;
+ int g;
+ g=a[9];
+ a[9]=min;
+ min=g;
+ System.out.println("改变后");
+ for (int i = 0; i < 10; i++) {
+ System.out.print(a[i]+"\t");
+ }
+
+ }
+}
\ No newline at end of file
--
Gitee