From 8538bc78a8cd660d38f3a4412bf94c80d679ee94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B0=B8=E6=B7=B3?= <2678158018@qq.com> Date: Sat, 26 Nov 2022 21:56:34 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20221126 java\345\217\230\351\207\217.md" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "18\345\276\220\346\260\270\346\267\263/20221126 java\345\217\230\351\207\217.md" diff --git "a/18\345\276\220\346\260\270\346\267\263/20221126 java\345\217\230\351\207\217.md" "b/18\345\276\220\346\260\270\346\267\263/20221126 java\345\217\230\351\207\217.md" new file mode 100644 index 0000000..e69de29 -- Gitee From b0a5a0705f396fb609c9245bc4929277e72e2ef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B0=B8=E6=B7=B3?= <2678158018@qq.com> Date: Tue, 29 Nov 2022 20:07:49 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20221126 java\345\217\230\351\207\217.md" | 54 +++++++++++++++++++ ...16\351\242\204\347\256\227\347\254\246.md" | 39 ++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 "18\345\276\220\346\260\270\346\267\263/20221128 java\345\217\230\351\207\217\344\270\216\351\242\204\347\256\227\347\254\246.md" diff --git "a/18\345\276\220\346\260\270\346\267\263/20221126 java\345\217\230\351\207\217.md" "b/18\345\276\220\346\260\270\346\267\263/20221126 java\345\217\230\351\207\217.md" index e69de29..0ba0d24 100644 --- "a/18\345\276\220\346\260\270\346\267\263/20221126 java\345\217\230\351\207\217.md" +++ "b/18\345\276\220\346\260\270\346\267\263/20221126 java\345\217\230\351\207\217.md" @@ -0,0 +1,54 @@ +## 变量 + +# java + +1.字符 + +```java +char +``` + +2.整数 + +```java +int byte short long +``` + +3.小数 + +``` +float double +``` + +4.字符串 + +``` +string +``` + +5.布尔 + +``` +boolean +``` + + + +# 作业 + +``` +public class jajs { + public static void main(String[] args) { +String name = "班主任"; +String juzi = "我爱2班"; + String naj = "您的岗位永不调换"; + String jai="您的足迹却遍布四方"; + String jia="您的两鬓会有一天斑白"; + String ija="您的青春却百年不衰"; + System.out.println(juzi+","+"感谢" + name); + System.out.println(naj+","+jai+","+jia+","+ija+"。"); + } + + } +``` + diff --git "a/18\345\276\220\346\260\270\346\267\263/20221128 java\345\217\230\351\207\217\344\270\216\351\242\204\347\256\227\347\254\246.md" "b/18\345\276\220\346\260\270\346\267\263/20221128 java\345\217\230\351\207\217\344\270\216\351\242\204\347\256\227\347\254\246.md" new file mode 100644 index 0000000..6f2b358 --- /dev/null +++ "b/18\345\276\220\346\260\270\346\267\263/20221128 java\345\217\230\351\207\217\344\270\216\351\242\204\347\256\227\347\254\246.md" @@ -0,0 +1,39 @@ + + +今天学了java变量和运算符 +Scanner + +作业1 +import java.util.Scanner; + +public class D1 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + System.out.println("输入数字:"); + int as = sc.nextInt(); + int gewei = as % 10; + int shiwei = as / 10 % 10; + int baiwei = as / 10 / 10 % 10; + int qianwei = as / 10 / 10 / 10 % 10; + System.out.println("这个数个位是" + gewei + "这个数十位是" + shiwei + "这个数百位是" + baiwei + "这个数千位是" + qianwei); + } + +} +作业2 +import java.util.Scanner; + +public class D2 { + public static void main(String[] args) { + Scanner sc=new Scanner(System.in); + System.out.println("华氏度转换成摄氏度"); + int ad= sc.nextInt(); + int s=ad-32; + System.out.println((s*5)/9); + + Scanner sd=new Scanner(System.in); + System.out.println("摄氏度转为华氏度"); + int as=sc.nextInt(); + int w=(as*9)/5; + System.out.println(w+32); + } +} \ No newline at end of file -- Gitee From 1e960beb7997e1c6640bd27a33180f71e5731532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B0=B8=E6=B7=B3?= <2678158018@qq.com> Date: Tue, 29 Nov 2022 20:12:52 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20221126 java\345\217\230\351\207\217.md" | 54 ------------------- 1 file changed, 54 deletions(-) delete mode 100644 "18\345\276\220\346\260\270\346\267\263/20221126 java\345\217\230\351\207\217.md" diff --git "a/18\345\276\220\346\260\270\346\267\263/20221126 java\345\217\230\351\207\217.md" "b/18\345\276\220\346\260\270\346\267\263/20221126 java\345\217\230\351\207\217.md" deleted file mode 100644 index 0ba0d24..0000000 --- "a/18\345\276\220\346\260\270\346\267\263/20221126 java\345\217\230\351\207\217.md" +++ /dev/null @@ -1,54 +0,0 @@ -## 变量 - -# java - -1.字符 - -```java -char -``` - -2.整数 - -```java -int byte short long -``` - -3.小数 - -``` -float double -``` - -4.字符串 - -``` -string -``` - -5.布尔 - -``` -boolean -``` - - - -# 作业 - -``` -public class jajs { - public static void main(String[] args) { -String name = "班主任"; -String juzi = "我爱2班"; - String naj = "您的岗位永不调换"; - String jai="您的足迹却遍布四方"; - String jia="您的两鬓会有一天斑白"; - String ija="您的青春却百年不衰"; - System.out.println(juzi+","+"感谢" + name); - System.out.println(naj+","+jai+","+jia+","+ija+"。"); - } - - } -``` - -- Gitee From a8b678358fca724c2bd5bc36811dfc7c9d1365b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B0=B8=E6=B7=B3?= <2678158018@qq.com> Date: Tue, 29 Nov 2022 20:18:58 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...16\351\242\204\347\256\227\347\254\246.md" | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git "a/18\345\276\220\346\260\270\346\267\263/20221128 java\345\217\230\351\207\217\344\270\216\351\242\204\347\256\227\347\254\246.md" "b/18\345\276\220\346\260\270\346\267\263/20221128 java\345\217\230\351\207\217\344\270\216\351\242\204\347\256\227\347\254\246.md" index 6f2b358..7f0ed3d 100644 --- "a/18\345\276\220\346\260\270\346\267\263/20221128 java\345\217\230\351\207\217\344\270\216\351\242\204\347\256\227\347\254\246.md" +++ "b/18\345\276\220\346\260\270\346\267\263/20221128 java\345\217\230\351\207\217\344\270\216\351\242\204\347\256\227\347\254\246.md" @@ -4,9 +4,11 @@ Scanner 作业1 + +```java import java.util.Scanner; -public class D1 { +public class jajs { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("输入数字:"); @@ -18,6 +20,9 @@ public class D1 { System.out.println("这个数个位是" + gewei + "这个数十位是" + shiwei + "这个数百位是" + baiwei + "这个数千位是" + qianwei); } +} +``` + } 作业2 import java.util.Scanner; @@ -30,10 +35,12 @@ public class D2 { int s=ad-32; System.out.println((s*5)/9); - Scanner sd=new Scanner(System.in); - System.out.println("摄氏度转为华氏度"); - int as=sc.nextInt(); - int w=(as*9)/5; - System.out.println(w+32); - } +```java + Scanner sd=new Scanner(System.in); + System.out.println("摄氏度转为华氏度"); + int as=sc.nextInt(); + int w=(as*9)/5; + System.out.println(w+32); +} +``` } \ No newline at end of file -- Gitee From 3fe1317f7eb031fe47900a26e264804e9c9fb235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B0=B8=E6=B7=B3?= <2678158018@qq.com> Date: Tue, 29 Nov 2022 20:24:52 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...16\351\242\204\347\256\227\347\254\246.md" | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git "a/18\345\276\220\346\260\270\346\267\263/20221128 java\345\217\230\351\207\217\344\270\216\351\242\204\347\256\227\347\254\246.md" "b/18\345\276\220\346\260\270\346\267\263/20221128 java\345\217\230\351\207\217\344\270\216\351\242\204\347\256\227\347\254\246.md" index 7f0ed3d..7ba68aa 100644 --- "a/18\345\276\220\346\260\270\346\267\263/20221128 java\345\217\230\351\207\217\344\270\216\351\242\204\347\256\227\347\254\246.md" +++ "b/18\345\276\220\346\260\270\346\267\263/20221128 java\345\217\230\351\207\217\344\270\216\351\242\204\347\256\227\347\254\246.md" @@ -8,7 +8,7 @@ Scanner ```java import java.util.Scanner; -public class jajs { +public class D1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("输入数字:"); @@ -25,6 +25,8 @@ public class jajs { } 作业2 + +```java import java.util.Scanner; public class D2 { @@ -35,12 +37,14 @@ public class D2 { int s=ad-32; System.out.println((s*5)/9); -```java - Scanner sd=new Scanner(System.in); - System.out.println("摄氏度转为华氏度"); - int as=sc.nextInt(); - int w=(as*9)/5; - System.out.println(w+32); + + Scanner sd=new Scanner(System.in); + System.out.println("摄氏度转为华氏度"); + int as=sc.nextInt(); + int w=(as*9)/5; + System.out.println(w+32); + } + + } -``` -} \ No newline at end of file +``` \ No newline at end of file -- Gitee From 6b0546fe519a9f8d27633b8cef01869003440b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B0=B8=E6=B7=B3?= <2678158018@qq.com> Date: Tue, 29 Nov 2022 21:39:47 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20221126 java\345\217\230\351\207\217.md" | 54 +++++++++++++++++++ .../java-base" | 1 + 2 files changed, 55 insertions(+) create mode 100644 "18\345\276\220\346\260\270\346\267\263/20221126 java\345\217\230\351\207\217.md" create mode 160000 "18\345\276\220\346\260\270\346\267\263/java-base" diff --git "a/18\345\276\220\346\260\270\346\267\263/20221126 java\345\217\230\351\207\217.md" "b/18\345\276\220\346\260\270\346\267\263/20221126 java\345\217\230\351\207\217.md" new file mode 100644 index 0000000..0ba0d24 --- /dev/null +++ "b/18\345\276\220\346\260\270\346\267\263/20221126 java\345\217\230\351\207\217.md" @@ -0,0 +1,54 @@ +## 变量 + +# java + +1.字符 + +```java +char +``` + +2.整数 + +```java +int byte short long +``` + +3.小数 + +``` +float double +``` + +4.字符串 + +``` +string +``` + +5.布尔 + +``` +boolean +``` + + + +# 作业 + +``` +public class jajs { + public static void main(String[] args) { +String name = "班主任"; +String juzi = "我爱2班"; + String naj = "您的岗位永不调换"; + String jai="您的足迹却遍布四方"; + String jia="您的两鬓会有一天斑白"; + String ija="您的青春却百年不衰"; + System.out.println(juzi+","+"感谢" + name); + System.out.println(naj+","+jai+","+jia+","+ija+"。"); + } + + } +``` + diff --git "a/18\345\276\220\346\260\270\346\267\263/java-base" "b/18\345\276\220\346\260\270\346\267\263/java-base" new file mode 160000 index 0000000..3fe1317 --- /dev/null +++ "b/18\345\276\220\346\260\270\346\267\263/java-base" @@ -0,0 +1 @@ +Subproject commit 3fe1317f7eb031fe47900a26e264804e9c9fb235 -- Gitee From a6e4a13d7f05d8cbfae1428b2f77c6ede521b5cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B0=B8=E6=B7=B3?= <2678158018@qq.com> Date: Tue, 29 Nov 2022 21:42:25 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "18\345\276\220\346\260\270\346\267\263/java-base" | 1 - 1 file changed, 1 deletion(-) delete mode 160000 "18\345\276\220\346\260\270\346\267\263/java-base" diff --git "a/18\345\276\220\346\260\270\346\267\263/java-base" "b/18\345\276\220\346\260\270\346\267\263/java-base" deleted file mode 160000 index 3fe1317..0000000 --- "a/18\345\276\220\346\260\270\346\267\263/java-base" +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3fe1317f7eb031fe47900a26e264804e9c9fb235 -- Gitee From eb11ce49a8a70ab0a3b250dc5244a9dd14a15dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B0=B8=E6=B7=B3?= <2678158018@qq.com> Date: Thu, 1 Dec 2022 19:49:12 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...47\345\210\266\350\257\255\345\217\245.md" | 179 ++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 "18\345\276\220\346\260\270\346\267\263/202211121 java\350\277\220\347\256\227\347\254\246\344\270\216\346\265\201\347\250\213\346\216\247\345\210\266\350\257\255\345\217\245.md" diff --git "a/18\345\276\220\346\260\270\346\267\263/202211121 java\350\277\220\347\256\227\347\254\246\344\270\216\346\265\201\347\250\213\346\216\247\345\210\266\350\257\255\345\217\245.md" "b/18\345\276\220\346\260\270\346\267\263/202211121 java\350\277\220\347\256\227\347\254\246\344\270\216\346\265\201\347\250\213\346\216\247\345\210\266\350\257\255\345\217\245.md" new file mode 100644 index 0000000..30849dd --- /dev/null +++ "b/18\345\276\220\346\260\270\346\267\263/202211121 java\350\277\220\347\256\227\347\254\246\344\270\216\346\265\201\347\250\213\346\216\247\345\210\266\350\257\255\345\217\245.md" @@ -0,0 +1,179 @@ +自增自减运算符 + +++ + +-- + +赋值运算符 + += 赋值 + ++= 加后赋值 a+=b = a=a+b + +-= 加后赋值 a-=b = a=a-b + +``` +*= 加后赋值 a*=b = a=a*b +``` + +/= 加后赋值 a/=b = a=a/b + +%= 加后赋值 a%=b = a=a%b + +关系运算符 + +== a==b 看这俩是不是一样 + +``` +>= a>=b a可以大于b也可以等于b +``` + +``` +> a>b a只能大于b +``` + +< ax)&&(b>x) 若左边的数值为true 那右边的公式参与运算,若左边的数值为false 那右边的公式不参与运算 + +|| 设一个数值为a 另一个数值和a完全不同的b a || b (a>x)|| (b>x) 若左边的数值为false 那右边的公式参与运算,若左边的数值为false 那右边的公式不参与运算 + +三元运算符 + +a>b?a:b + +问号前面的位置是判断的条件,判断结果为boolean型,为true时调用表达式1,为false时调用表 达式2。其逻辑为:如果条件表达式成立或者满足则执行表达式1,否则执行第二个。 + + + +作业 + +```java +import java.util.Scanner; + +public class zqd { + public static void main(String[] args) { + Scanner ad = new Scanner(System.in); + Scanner sf = new Scanner(System.in); + + while (true){ + System.out.println("请输入国足对日本队进球的数量"); + int sd = ad.nextInt(); + int as = sf.nextInt(); + + + if (sd > as) { + System.out.println("不可能,绝对不可能"); + } else if (sd == as) { + System.out.println("奖♂励♂大♂大的海参"); + }else if (sdaf?as:af; + int b=a>ag?a:ag; + System.out.println("最大的数"+b); + } +} +``` + +```java +import java.util.Scanner; + +public class D2 { + public static void main(String[] args) { + Scanner as = new Scanner(System.in); + System.out.println("两位数"); + int ar = as.nextInt(); + int ad = as.nextInt(); + if (ar + ad % 3 == 0 || ar%3==0||ad%3==0) { + System.out.println(true); + }else{ + System.out.println(false); + } + } +} +``` + +```java +import java.util.Scanner; + +public class D3 { + public static void main(String[] args) { + + int a=177; + int b=165; + float as=(float) (a+b*1.08)/2; + float c=(float) (a*0.923+165)/2; + System.out.println("儿子身高:"+as); + System.out.println("女儿身高:"+c); + } +} +``` + +```java +public class D4 { + public static void main(String[] args) { + int a=21; + int b=24; + int c=(21*2)+3; + int e=24*2; + int f=c>e?c:e; + System.out.println("红茶妹妹有"+c+"元,"+"绿茶妹妹有"+e+"元"+",所以不相同。"); + + } +} +``` + +```java +public class D6 { + public static void main(String[] args) { + int a=24; + int b=8; + int c=3; + int d=16; + double ad=(a+b+c)*0.8; + double as=(d+b+c); +// int e=(); + System.out.println("用了折扣券的价格是"+ad); + System.out.println("用了优惠价的价格是"+as); + System.out.println("所以用了"+(ad