From 6ae338f9c05600afd21ff661568caf18587ddce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B0=91=E6=B5=B7?= <3087930763@qq.com> Date: Fri, 25 Nov 2022 17:24:22 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E6=88=91=E7=9A=84=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E6=AC=A1=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\346\210\221\347\210\261\344\270\211\347\217\255.java" | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 "21 \345\210\230\345\260\221\346\265\267/\346\210\221\347\210\261\344\270\211\347\217\255.java" diff --git "a/21 \345\210\230\345\260\221\346\265\267/\346\210\221\347\210\261\344\270\211\347\217\255.java" "b/21 \345\210\230\345\260\221\346\265\267/\346\210\221\347\210\261\344\270\211\347\217\255.java" new file mode 100644 index 0000000..3851674 --- /dev/null +++ "b/21 \345\210\230\345\260\221\346\265\267/\346\210\221\347\210\261\344\270\211\347\217\255.java" @@ -0,0 +1,8 @@ +public class 我爱三班 { + public static void main(String[] args) { + String teachername = "邱老师"; + String Tezchername = "肖俊"; + System.out.println(Tezchername+"你是花儿,你是光。你是闽大顶呱呱.永远3班,年年十八"); + System.out.println(teachername+",是美的耕耘者,美的播种者。是您用美的阳光普照,用美的雨露滋润,我们的心田才绿草如茵,繁花似锦。"); + } +} \ No newline at end of file -- Gitee From dce655d02c220b8e69519db9e800884bd0e2fb08 Mon Sep 17 00:00:00 2001 From: "3087930763@qq.com" <3087930763@qq.com> Date: Tue, 29 Nov 2022 11:40:31 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E5=AE=9E=E9=AA=8C2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\345\256\236\351\252\214.txt" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "21 \345\210\230\345\260\221\346\265\267/\345\256\236\351\252\214.txt" diff --git "a/21 \345\210\230\345\260\221\346\265\267/\345\256\236\351\252\214.txt" "b/21 \345\210\230\345\260\221\346\265\267/\345\256\236\351\252\214.txt" new file mode 100644 index 0000000..e69de29 -- Gitee From 58887adb20540d74909226ff5c258be7e394f83b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B0=91=E6=B5=B7?= <3087930763@qq.com> Date: Tue, 29 Nov 2022 20:28:50 +0800 Subject: [PATCH 03/14] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../11 29 idea/.idea/.gitignore" | 8 +++++++ .../11 29 idea/.idea/idea.iml" | 11 ++++++++++ .../11 29 idea/.idea/misc.xml" | 6 ++++++ .../11 29 idea/.idea/modules.xml" | 9 ++++++++ .../11 29 idea/mokai/mokai.iml" | 8 +++++++ .../out/production/idea/java.class" | Bin 0 -> 1210 bytes .../out/production/idea/runnian.class" | Bin 0 -> 967 bytes .../out/production/idea/wendu.class" | Bin 0 -> 864 bytes .../11 29 idea/src/java.java" | 17 +++++++++++++++ .../11 29 idea/src/runnian.java" | 15 +++++++++++++ .../11 29 idea/src/wendu.java" | 13 ++++++++++++ ...022 11 25 java\347\254\224\350\256\260.md" | 20 ++++++++++++++++++ .../2022 11 29 \345\256\236\351\252\214.txt" | 1 + 13 files changed, 108 insertions(+) create mode 100644 "21 \345\210\230\345\260\221\346\265\267/11 29 idea/.idea/.gitignore" create mode 100644 "21 \345\210\230\345\260\221\346\265\267/11 29 idea/.idea/idea.iml" create mode 100644 "21 \345\210\230\345\260\221\346\265\267/11 29 idea/.idea/misc.xml" create mode 100644 "21 \345\210\230\345\260\221\346\265\267/11 29 idea/.idea/modules.xml" create mode 100644 "21 \345\210\230\345\260\221\346\265\267/11 29 idea/mokai/mokai.iml" create mode 100644 "21 \345\210\230\345\260\221\346\265\267/11 29 idea/out/production/idea/java.class" create mode 100644 "21 \345\210\230\345\260\221\346\265\267/11 29 idea/out/production/idea/runnian.class" create mode 100644 "21 \345\210\230\345\260\221\346\265\267/11 29 idea/out/production/idea/wendu.class" create mode 100644 "21 \345\210\230\345\260\221\346\265\267/11 29 idea/src/java.java" create mode 100644 "21 \345\210\230\345\260\221\346\265\267/11 29 idea/src/runnian.java" create mode 100644 "21 \345\210\230\345\260\221\346\265\267/11 29 idea/src/wendu.java" create mode 100644 "21 \345\210\230\345\260\221\346\265\267/2022 11 25 java\347\254\224\350\256\260.md" create mode 100644 "21 \345\210\230\345\260\221\346\265\267/2022 11 29 \345\256\236\351\252\214.txt" diff --git "a/21 \345\210\230\345\260\221\346\265\267/11 29 idea/.idea/.gitignore" "b/21 \345\210\230\345\260\221\346\265\267/11 29 idea/.idea/.gitignore" new file mode 100644 index 0000000..35410ca --- /dev/null +++ "b/21 \345\210\230\345\260\221\346\265\267/11 29 idea/.idea/.gitignore" @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git "a/21 \345\210\230\345\260\221\346\265\267/11 29 idea/.idea/idea.iml" "b/21 \345\210\230\345\260\221\346\265\267/11 29 idea/.idea/idea.iml" new file mode 100644 index 0000000..c90834f --- /dev/null +++ "b/21 \345\210\230\345\260\221\346\265\267/11 29 idea/.idea/idea.iml" @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git "a/21 \345\210\230\345\260\221\346\265\267/11 29 idea/.idea/misc.xml" "b/21 \345\210\230\345\260\221\346\265\267/11 29 idea/.idea/misc.xml" new file mode 100644 index 0000000..0548357 --- /dev/null +++ "b/21 \345\210\230\345\260\221\346\265\267/11 29 idea/.idea/misc.xml" @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git "a/21 \345\210\230\345\260\221\346\265\267/11 29 idea/.idea/modules.xml" "b/21 \345\210\230\345\260\221\346\265\267/11 29 idea/.idea/modules.xml" new file mode 100644 index 0000000..0dec258 --- /dev/null +++ "b/21 \345\210\230\345\260\221\346\265\267/11 29 idea/.idea/modules.xml" @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git "a/21 \345\210\230\345\260\221\346\265\267/11 29 idea/mokai/mokai.iml" "b/21 \345\210\230\345\260\221\346\265\267/11 29 idea/mokai/mokai.iml" new file mode 100644 index 0000000..183c2ef --- /dev/null +++ "b/21 \345\210\230\345\260\221\346\265\267/11 29 idea/mokai/mokai.iml" @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git "a/21 \345\210\230\345\260\221\346\265\267/11 29 idea/out/production/idea/java.class" "b/21 \345\210\230\345\260\221\346\265\267/11 29 idea/out/production/idea/java.class" new file mode 100644 index 0000000000000000000000000000000000000000..a81e666182a6805fe1a600b3773c1c1d3a440589 GIT binary patch literal 1210 zcmaJ=+fEZv6kVs&cG@yPxfD=~7rYe^s)+ScKmzuXD^vCaSYXEw2D}V;HtLX5f z6Q=@jp-X1nK12gJjWZJIQE@f^KiXyJ_2HacV=|og;ernreYm6|uA)!C+h9n%Y@+*d%iJ!Q_3BRQ=<(Bqt*(M?OB zDRSRIqFLRVjHc{@X-&o*cD*pk{)S!30$*5%T8(dk|u5;x5Wn zaP@SoKzwn^&5T|LRM5g)D>q;t_H*aQ0fdQgSPVjeO6=1rT;t17R^U!9!&C1qLG3KT z*B=fB@&gQ6t}%Bwm~j$MxK7#3#=LA@g@1enfp7^`^;!wltxQU&;ru_vS{6g@y{bW3 z_3TxxlU3fS!n~!jhuSC|Rn*%+B`xrwl?qQFKx3*9V?Bjx%%TR*QHzfVI*yE%RkQaX x=d17zhj5slwBR+3ZllGmc!8tL6mmVoF=lQuKEiQk9`eo;Z*yEeNd^}pe*jgE7g+!R literal 0 HcmV?d00001 diff --git "a/21 \345\210\230\345\260\221\346\265\267/11 29 idea/out/production/idea/runnian.class" "b/21 \345\210\230\345\260\221\346\265\267/11 29 idea/out/production/idea/runnian.class" new file mode 100644 index 0000000000000000000000000000000000000000..6e8eab3ecffd727c537ac2a458363c1efb10346d GIT binary patch literal 967 zcmZuv+fEZv6kTU#+QYQNwSX1trCwVQ>IKnqt%4?)dWkh8;M25DaG;%%VaDj2FNO~= z#>98yqsjv$YWM*E1H%vas;<*E0SzZPbN1Pnwbx#Ae*FHr17H+$F?3=`;-ZORjKrWJ zr>skDxE#Y3TveXYXrYVAT+zZ}(@?Q%5@QnA1)`I#=LXXPdM3LdV9eH^Is%bu0Wg&7nq+{7(q%?ijCxy01wJ5P9^xqReHG|I2=h+ za`iQ5cI&x$Z!HX{mt)sBbux2kKnbbWLjvv>KBUC^g^5OQ;vI04+nP$Ms)jA#|9_A4 zoEO2oM`XSSifv?;vI|I~gD*`j4IBd9{Pysc<0*JX2Dc%;G{OmfqYbByUfNbO0e$G_ z&BPHT=~2bMU@!{Y{swJv6Z$rc;wBS#7QFo$#!i>v2mLIv-A$L=_J}Q$C(ttM~ssM zj$(jk9OF2~d`i#E<2b>IQ^?{ZP7yy%gfy*4<2+4EGAoHQv`nI!^q(Wfc_Q^g`@{Dm TB`!#0gw6#NlwMgzH4Od*DSf=> literal 0 HcmV?d00001 diff --git "a/21 \345\210\230\345\260\221\346\265\267/11 29 idea/out/production/idea/wendu.class" "b/21 \345\210\230\345\260\221\346\265\267/11 29 idea/out/production/idea/wendu.class" new file mode 100644 index 0000000000000000000000000000000000000000..295d34e9cc106d3995f9adce3bb902068371016d GIT binary patch literal 864 zcmZuv+int36kTUv7@%WXE=5$lfLfug#Y=5PS|qVC!4NgUkQko^I>D(hG{cOS4={d! z-=K+4jeP)9lYW5zQPZz5t~0cun$BdOv(MUluYEb^*Pp$80L!RG5yK4)`3MS_k3zwM z)E2|I8O0Kc61f$sR_V+yR81Z$xv?UhZfm%s;jTbv&9W`GA`r+IngYQ`{Y_I~x^CI# zQ?J)Dofk%{OC(ZGklg^)NkOK Date: Tue, 29 Nov 2022 12:31:03 +0000 Subject: [PATCH 04/14] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=2021?= =?UTF-8?q?=20=E5=88=98=E5=B0=91=E6=B5=B7/=E5=AE=9E=E9=AA=8C.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\345\256\236\351\252\214.txt" | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 "21 \345\210\230\345\260\221\346\265\267/\345\256\236\351\252\214.txt" diff --git "a/21 \345\210\230\345\260\221\346\265\267/\345\256\236\351\252\214.txt" "b/21 \345\210\230\345\260\221\346\265\267/\345\256\236\351\252\214.txt" deleted file mode 100644 index e69de29..0000000 -- Gitee From b01671878d306f850c613c0cbaa1d03a8271af63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B0=91=E6=B5=B7?= <3087930763@qq.com> Date: Tue, 29 Nov 2022 12:31:16 +0000 Subject: [PATCH 05/14] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=2021?= =?UTF-8?q?=20=E5=88=98=E5=B0=91=E6=B5=B7/=E5=AE=9E=E9=AA=8C.text?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\345\256\236\351\252\214.text" | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 "21 \345\210\230\345\260\221\346\265\267/\345\256\236\351\252\214.text" diff --git "a/21 \345\210\230\345\260\221\346\265\267/\345\256\236\351\252\214.text" "b/21 \345\210\230\345\260\221\346\265\267/\345\256\236\351\252\214.text" deleted file mode 100644 index e69de29..0000000 -- Gitee From 5a7479c3e8cbaa871e6a30ba6771e9dc039bc847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B0=91=E6=B5=B7?= <3087930763@qq.com> Date: Wed, 30 Nov 2022 23:16:50 +0800 Subject: [PATCH 06/14] =?UTF-8?q?11=2029=20java=E7=AC=94=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java.java" | 17 ++++++++++ .../java\347\254\224\350\256\2602.md" | 32 +++++++++++++++++++ .../wendu.java" | 16 ++++++++++ 3 files changed, 65 insertions(+) create mode 100644 "21 \345\210\230\345\260\221\346\265\267/java.java" create mode 100644 "21 \345\210\230\345\260\221\346\265\267/java\347\254\224\350\256\2602.md" create mode 100644 "21 \345\210\230\345\260\221\346\265\267/wendu.java" diff --git "a/21 \345\210\230\345\260\221\346\265\267/java.java" "b/21 \345\210\230\345\260\221\346\265\267/java.java" new file mode 100644 index 0000000..a57e750 --- /dev/null +++ "b/21 \345\210\230\345\260\221\346\265\267/java.java" @@ -0,0 +1,17 @@ +import java.util.Scanner; + +public class java { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + System.out.println("请输入四位数"); + int num =sc.nextInt(); + int ge = num % 10; + int shi = num / 10 % 10; + int bai = num / 100 % 10; + int qian = num / 1000; + System.out.println(num+"个位是" + ge); + System.out.println(num+"十位" + shi); + System.out.println(num+"百位" + bai); + System.out.println(num+"千位" + qian); + } +} diff --git "a/21 \345\210\230\345\260\221\346\265\267/java\347\254\224\350\256\2602.md" "b/21 \345\210\230\345\260\221\346\265\267/java\347\254\224\350\256\2602.md" new file mode 100644 index 0000000..038df89 --- /dev/null +++ "b/21 \345\210\230\345\260\221\346\265\267/java\347\254\224\350\256\2602.md" @@ -0,0 +1,32 @@ +### 1.2 强制转换(理解) + +​ 把一个表示数据范围大的数值或者变量赋值给另一个表示数据范围小的变量。 + +​ 强制类型转换格式:目标数据类型 变量名 = (目标数据类型)值或者变量; + +​ 例如: + +```java +double num1 = 5.5; +int num2 = (int) num1; // 将double类型的num1强制转换为int类型 +System.out.println(num2); // 输出5(小数位直接舍弃) +``` + +### 1.3 类型转换案例(理解) + +案例代码: + +```java +byte a = 3; +byte b = 4; +byte c = a + b; //错误。因为两个byte变量相加,会先提升为int类型 +byte d = 3 + 4; //正确。常量优化机制 +``` + +**常量优化机制**: + +​ 在编译时,整数常量的计算会直接算出结果,并且会自动判断该结果是否在byte取值范围内, + +- 在:编译通过 + +- 不在:编译失败 \ No newline at end of file diff --git "a/21 \345\210\230\345\260\221\346\265\267/wendu.java" "b/21 \345\210\230\345\260\221\346\265\267/wendu.java" new file mode 100644 index 0000000..66b1f22 --- /dev/null +++ "b/21 \345\210\230\345\260\221\346\265\267/wendu.java" @@ -0,0 +1,16 @@ +import java.util.Scanner; + +public class wendu { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + System.out.println("请输入温度"); + double num = sc.nextDouble(); + double a = 32; + double b = 5; + double c = 9; + System.out.println((num - a) * b / c); + System.out.println("请输入华氏温度"); + double Num = sc.nextDouble(); + System.out.println(Num * 9 / 5 + 32); + } +} -- Gitee From ea05405e76f14fc0cb80e60731450666d2d85b84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B0=91=E6=B5=B7?= <3087930763@qq.com> Date: Thu, 1 Dec 2022 11:16:08 +0800 Subject: [PATCH 07/14] shiyan1 --- "21 \345\210\230\345\260\221\346\265\267/shiyan1.txt" | 1 + 1 file changed, 1 insertion(+) create mode 100644 "21 \345\210\230\345\260\221\346\265\267/shiyan1.txt" diff --git "a/21 \345\210\230\345\260\221\346\265\267/shiyan1.txt" "b/21 \345\210\230\345\260\221\346\265\267/shiyan1.txt" new file mode 100644 index 0000000..fe46914 --- /dev/null +++ "b/21 \345\210\230\345\260\221\346\265\267/shiyan1.txt" @@ -0,0 +1 @@ +shiyan1 -- Gitee From 58d9e667a58d4f7ab338dbdb52d8406aa33ac9be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B0=91=E6=B5=B7?= <3087930763@qq.com> Date: Thu, 1 Dec 2022 11:19:18 +0800 Subject: [PATCH 08/14] shiyan2 --- "21 \345\210\230\345\260\221\346\265\267/shiyan2.txt" | 1 + 1 file changed, 1 insertion(+) create mode 100644 "21 \345\210\230\345\260\221\346\265\267/shiyan2.txt" diff --git "a/21 \345\210\230\345\260\221\346\265\267/shiyan2.txt" "b/21 \345\210\230\345\260\221\346\265\267/shiyan2.txt" new file mode 100644 index 0000000..c0ac137 --- /dev/null +++ "b/21 \345\210\230\345\260\221\346\265\267/shiyan2.txt" @@ -0,0 +1 @@ +shiyan2 \ No newline at end of file -- Gitee From 1965570b49c39d6cc6cea03b1bb4ba2eac718cc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B0=91=E6=B5=B7?= <3087930763@qq.com> Date: Thu, 1 Dec 2022 11:24:04 +0800 Subject: [PATCH 09/14] Shiyan3 --- "21 \345\210\230\345\260\221\346\265\267/Shiyan3.txt" | 1 + 1 file changed, 1 insertion(+) create mode 100644 "21 \345\210\230\345\260\221\346\265\267/Shiyan3.txt" diff --git "a/21 \345\210\230\345\260\221\346\265\267/Shiyan3.txt" "b/21 \345\210\230\345\260\221\346\265\267/Shiyan3.txt" new file mode 100644 index 0000000..3c13e1a --- /dev/null +++ "b/21 \345\210\230\345\260\221\346\265\267/Shiyan3.txt" @@ -0,0 +1 @@ +Shiyan3 \ No newline at end of file -- Gitee From 0af9023946e7ea6840486ef9cca613a2adb9fe4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B0=91=E6=B5=B7?= <3087930763@qq.com> Date: Thu, 1 Dec 2022 03:32:51 +0000 Subject: [PATCH 10/14] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=2021?= =?UTF-8?q?=20=E5=88=98=E5=B0=91=E6=B5=B7/Shiyan3.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "21 \345\210\230\345\260\221\346\265\267/Shiyan3.txt" | 1 - 1 file changed, 1 deletion(-) delete mode 100644 "21 \345\210\230\345\260\221\346\265\267/Shiyan3.txt" diff --git "a/21 \345\210\230\345\260\221\346\265\267/Shiyan3.txt" "b/21 \345\210\230\345\260\221\346\265\267/Shiyan3.txt" deleted file mode 100644 index 3c13e1a..0000000 --- "a/21 \345\210\230\345\260\221\346\265\267/Shiyan3.txt" +++ /dev/null @@ -1 +0,0 @@ -Shiyan3 \ No newline at end of file -- Gitee From 5fd3d134032ff3bc2ed5c272463b70d7b5c562d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B0=91=E6=B5=B7?= <3087930763@qq.com> Date: Thu, 1 Dec 2022 03:33:02 +0000 Subject: [PATCH 11/14] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=2021?= =?UTF-8?q?=20=E5=88=98=E5=B0=91=E6=B5=B7/shiyan1.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "21 \345\210\230\345\260\221\346\265\267/shiyan1.txt" | 1 - 1 file changed, 1 deletion(-) delete mode 100644 "21 \345\210\230\345\260\221\346\265\267/shiyan1.txt" diff --git "a/21 \345\210\230\345\260\221\346\265\267/shiyan1.txt" "b/21 \345\210\230\345\260\221\346\265\267/shiyan1.txt" deleted file mode 100644 index fe46914..0000000 --- "a/21 \345\210\230\345\260\221\346\265\267/shiyan1.txt" +++ /dev/null @@ -1 +0,0 @@ -shiyan1 -- Gitee From ecbc417f8a812fcb90c726e0078a45f51095b6b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B0=91=E6=B5=B7?= <3087930763@qq.com> Date: Thu, 1 Dec 2022 03:33:15 +0000 Subject: [PATCH 12/14] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=2021?= =?UTF-8?q?=20=E5=88=98=E5=B0=91=E6=B5=B7/shiyan2.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "21 \345\210\230\345\260\221\346\265\267/shiyan2.txt" | 1 - 1 file changed, 1 deletion(-) delete mode 100644 "21 \345\210\230\345\260\221\346\265\267/shiyan2.txt" diff --git "a/21 \345\210\230\345\260\221\346\265\267/shiyan2.txt" "b/21 \345\210\230\345\260\221\346\265\267/shiyan2.txt" deleted file mode 100644 index c0ac137..0000000 --- "a/21 \345\210\230\345\260\221\346\265\267/shiyan2.txt" +++ /dev/null @@ -1 +0,0 @@ -shiyan2 \ No newline at end of file -- Gitee From 94da9a99de7b437567e1c550b5a1a10e6d66f2e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B0=91=E6=B5=B7?= <3087930763@qq.com> Date: Thu, 1 Dec 2022 03:33:26 +0000 Subject: [PATCH 13/14] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=2021?= =?UTF-8?q?=20=E5=88=98=E5=B0=91=E6=B5=B7/2022=2011=2029=20=E5=AE=9E?= =?UTF-8?q?=E9=AA=8C.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2022 11 29 \345\256\236\351\252\214.txt" | 1 - 1 file changed, 1 deletion(-) delete mode 100644 "21 \345\210\230\345\260\221\346\265\267/2022 11 29 \345\256\236\351\252\214.txt" diff --git "a/21 \345\210\230\345\260\221\346\265\267/2022 11 29 \345\256\236\351\252\214.txt" "b/21 \345\210\230\345\260\221\346\265\267/2022 11 29 \345\256\236\351\252\214.txt" deleted file mode 100644 index 190a180..0000000 --- "a/21 \345\210\230\345\260\221\346\265\267/2022 11 29 \345\256\236\351\252\214.txt" +++ /dev/null @@ -1 +0,0 @@ -123 -- Gitee From 3aa2a90a387df774fda1477d49a0a4819057f1c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B0=91=E6=B5=B7?= <3087930763@qq.com> Date: Fri, 2 Dec 2022 12:20:54 +0800 Subject: [PATCH 14/14] 12 1 --- .../12 1 Java\347\254\224\350\256\260.md" | 254 ++++++++++++++++++ .../12 1/java1.java" | 20 ++ .../12 1/java2.java" | 19 ++ .../12 1/java3.java" | 8 + .../12 1/java4.java" | 8 + .../12 1/java5.java" | 18 ++ 6 files changed, 327 insertions(+) create mode 100644 "21 \345\210\230\345\260\221\346\265\267/12 1/12 1 Java\347\254\224\350\256\260.md" create mode 100644 "21 \345\210\230\345\260\221\346\265\267/12 1/java1.java" create mode 100644 "21 \345\210\230\345\260\221\346\265\267/12 1/java2.java" create mode 100644 "21 \345\210\230\345\260\221\346\265\267/12 1/java3.java" create mode 100644 "21 \345\210\230\345\260\221\346\265\267/12 1/java4.java" create mode 100644 "21 \345\210\230\345\260\221\346\265\267/12 1/java5.java" diff --git "a/21 \345\210\230\345\260\221\346\265\267/12 1/12 1 Java\347\254\224\350\256\260.md" "b/21 \345\210\230\345\260\221\346\265\267/12 1/12 1 Java\347\254\224\350\256\260.md" new file mode 100644 index 0000000..f566e07 --- /dev/null +++ "b/21 \345\210\230\345\260\221\346\265\267/12 1/12 1 Java\347\254\224\350\256\260.md" @@ -0,0 +1,254 @@ +### 2.3 赋值运算符(应用) + +赋值运算符的作用是将一个表达式的值赋给左边,左边必须是可修改的,不能是常量。 + +| 符号 | 作用 | 说明 | +| ---- | ---------- | --------------------- | +| = | 赋值 | a=10,将10赋值给变量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 | + +注意: + +扩展的赋值运算符隐含了强制类型转换。 + +~~~java +short s = 10; +s = s + 10; // 此行代码报出,因为运算中s提升为int类型,运算结果int赋值给short可能损失精度 + +s += 10; // 此行代码没有问题,隐含了强制类型转换,相当于 s = (short) (s + 10); +~~~ + +### 2.4 关系运算符(应用) + +关系运算符有6种关系,分别为小于、小于等于、大于、等于、大于等于、不等于。 + +| 符号 | 说明 | +| ---- | ------------------------------------------------------- | +| == | a==b,判断a和b的值是否相等,成立为true,不成立为false | +| != | a!=b,判断a和b的值是否不相等,成立为true,不成立为false | +| > | a>b,判断a是否大于b,成立为true,不成立为false | +| >= | a>=b,判断a是否大于等于b,成立为true,不成立为false | +| < | a b); // false +System.out.println(a >= b); // false +System.out.println(a < b); // true +System.out.println(a <= b); // true + +// 关系运算的结果肯定是boolean类型,所以也可以将运算结果赋值给boolean类型的变量 +boolean flag = a > b; +System.out.println(flag); // 输出false +~~~ + +### 2.5 逻辑运算符(应用) + +逻辑运算符把各个运算的关系表达式连接起来组成一个复杂的逻辑表达式,以判断程序中的表达式是否成立,判断的结果是 true 或 false。 + +| 符号 | 作用 | 说明 | +| ---- | -------- | -------------------------------------------- | +| & | 逻辑与 | a&b,a和b都是true,结果为true,否则为false | +| \| | 逻辑或 | a\|b,a和b都是false,结果为false,否则为true | +| ^ | 逻辑异或 | a^b,a和b结果不同为true,相同为false | +| ! | 逻辑非 | !a,结果和a的结果正好相反 | + +~~~java +//定义变量 +int i = 10; +int j = 20; +int k = 30; + +//& “与”,并且的关系,只要表达式中有一个值为false,结果即为false +System.out.println((i > j) & (i > k)); //false & false,输出false +System.out.println((i < j) & (i > k)); //true & false,输出false +System.out.println((i > j) & (i < k)); //false & true,输出false +System.out.println((i < j) & (i < k)); //true & true,输出true +System.out.println("--------"); + +//| “或”,或者的关系,只要表达式中有一个值为true,结果即为true +System.out.println((i > j) | (i > k)); //false | false,输出false +System.out.println((i < j) | (i > k)); //true | false,输出true +System.out.println((i > j) | (i < k)); //false | true,输出true +System.out.println((i < j) | (i < k)); //true | true,输出true +System.out.println("--------"); + +//^ “异或”,相同为false,不同为true +System.out.println((i > j) ^ (i > k)); //false ^ false,输出false +System.out.println((i < j) ^ (i > k)); //true ^ false,输出true +System.out.println((i > j) ^ (i < k)); //false ^ true,输出true +System.out.println((i < j) ^ (i < k)); //true ^ true,输出false +System.out.println("--------"); + +//! “非”,取反 +System.out.println((i > j)); //false +System.out.println(!(i > j)); //!false,,输出true +~~~ + +### 2.6 短路逻辑运算符(理解) + +| 符号 | 作用 | 说明 | +| ---- | ------ | ---------------------------- | +| && | 短路与 | 作用和&相同,但是有短路效果 | +| \|\| | 短路或 | 作用和\|相同,但是有短路效果 | + +在逻辑与运算中,只要有一个表达式的值为false,那么结果就可以判定为false了,没有必要将所有表达式的值都计算出来,短路与操作就有这样的效果,可以提高效率。同理在逻辑或运算中,一旦发现值为true,右边的表达式将不再参与运算。 + +- 逻辑与&,无论左边真假,右边都要执行。 + +- 短路与&&,如果左边为真,右边执行;如果左边为假,右边不执行。 + +- 逻辑或|,无论左边真假,右边都要执行。 + +- 短路或||,如果左边为假,右边执行;如果左边为真,右边不执行。 + +~~~java +int x = 3; +int y = 4; +System.out.println((x++ > 4) & (y++ > 5)); // 两个表达都会运算 +System.out.println(x); // 4 +System.out.println(y); // 5 + +System.out.println((x++ > 4) && (y++ > 5)); // 左边已经可以确定结果为false,右边不参与运算 +System.out.println(x); // 4 +System.out.println(y); // 4 +~~~ + +### 2.7 三元运算符(理解) + +三元运算符语法格式: + +~~~java +关系表达式 ? 表达式1 : 表达式2; +~~~ + +解释:问号前面的位置是判断的条件,判断结果为boolean型,为true时调用表达式1,为false时调用表达式2。其逻辑为:如果条件表达式成立或者满足则执行表达式1,否则执行第二个。 + +举例: + +~~~java +int a = 10; +int b = 20; +int c = a > b ? a : b; // 判断 a>b 是否为真,如果为真取a的值,如果为假,取b的值 +~~~ + +### 2.8 三元运算符案例(应用) + +需求: + +​ 一座寺庙里住着三个和尚,已知他们的身高分别为150cm、210cm、165cm,请用程序实现获取这三个和尚的最高身高。 + +~~~java +public class OperatorTest02 { + public static void main(String[] args) { + //1:定义三个变量用于保存和尚的身高,单位为cm,这里仅仅体现数值即可。 + int height1 = 150; + int height2 = 210; + int height3 = 165; + //2:用三元运算符获取前两个和尚的较高身高值,并用临时身高变量保存起来。 + int tempHeight = height1 > height2 ? height1 : height2; + //3:用三元运算符获取临时身高值和第三个和尚身高较高值,并用最大身高变量保存。 + int maxHeight = tempHeight > height3 ? tempHeight : height3; + //4:输出结果 + System.out.println("maxHeight:" + maxHeight); + } +} +~~~ + +## 3. 流程控制语句 + +在一个程序执行的过程中,各条语句的执行顺序对程序的结果是有直接影响的。所以,我们必须清楚每条语句的执行流程。而且,很多时候要通过控制语句的执行顺序来实现我们想要的功能。 + +### 3.1 流程控制语句分类(了解) + +​ 顺序结构 + +​ 分支结构(if, switch) + +​ 循环结构(for, while, do…while) + +### 3.2 顺序结构(了解) + +顺序结构是程序中最简单最基本的流程控制,没有特定的语法结构,按照代码的先后顺序,依次执行,程序中大多数的代码都是这样执行的。 + +顺序结构执行流程图: + +![1545615769372](2img/图片2.png) + +### 3.3 分支结构之if语句 + +#### 3.3.1 if语句格式1(理解) + +~~~java +格式: +if (关系表达式) { + 语句体; +} +~~~ + +执行流程: + +①首先计算关系表达式的值 + +②如果关系表达式的值为true就执行语句体 + +③如果关系表达式的值为false就不执行语句体 + +④继续执行后面的语句内容 + +![1545616039363](2img/图片3.png) + +示例: + +~~~java +public class IfDemo { + public static void main(String[] args) { + System.out.println("开始"); + + // 如果年龄大于18岁, 就可以上网吧 + int age = 17; + + if(age >= 18){ + // int a = 10; + System.out.println("可以上网吧"); + } + + System.out.println("结束"); + } +} +~~~ + +#### 3.3.2 if语句格式2(理解) + +~~~java +格式: +if (关系表达式) { + 语句体1; +} else { + 语句体2; +} +~~~ + +执行流程: + +①首先计算关系表达式的值 + +②如果关系表达式的值为true就执行语句体1 + +③如果关系表达式的值为false就执行语句体2 + +④继续执行后面的语句内容 \ No newline at end of file diff --git "a/21 \345\210\230\345\260\221\346\265\267/12 1/java1.java" "b/21 \345\210\230\345\260\221\346\265\267/12 1/java1.java" new file mode 100644 index 0000000..3f34a11 --- /dev/null +++ "b/21 \345\210\230\345\260\221\346\265\267/12 1/java1.java" @@ -0,0 +1,20 @@ +public class java1 { + public static void main(String[] args) { +// Scanner sc = new Scanner(System.in); +// System.out.println(); +// int num = sc.nextInt(); +// int a = 10; +// int b = 20; +// int c = 30; +// int banjue = a > b ? a : b; +// int juesai = c>b?c:b; +// System.out.println("前二"+banjue); +// System.out.println("第一"+juesai); + double a =10.1; + double b = 20.1; + double c = 30.1; + double dier = a>b?a:b; + double diyi = b>c?b:c; + System.out.println("第一"+diyi); + } +} diff --git "a/21 \345\210\230\345\260\221\346\265\267/12 1/java2.java" "b/21 \345\210\230\345\260\221\346\265\267/12 1/java2.java" new file mode 100644 index 0000000..d4b596f --- /dev/null +++ "b/21 \345\210\230\345\260\221\346\265\267/12 1/java2.java" @@ -0,0 +1,19 @@ +import java.util.Scanner; + +public class java2 { + public static void main(String[] args) { +// Scanner sc = new Scanner(System.in); +// System.out.println("请输入数字"); +// double num = sc.nextDouble(); +// System.out.println("num"); + Scanner sc = new Scanner(System.in); + System.out.println("请输入数字"); + double num = sc.nextDouble(); + System.out.println("请输入数字"); + double num2 = sc.nextDouble(); +// boolean bo=num==3 ||num2==3 ||(num+num2)%3==0; + boolean bo = num==3 || num2==3 ||(num+num2)%3==0; + System.out.println(bo); + + } +} diff --git "a/21 \345\210\230\345\260\221\346\265\267/12 1/java3.java" "b/21 \345\210\230\345\260\221\346\265\267/12 1/java3.java" new file mode 100644 index 0000000..cf90918 --- /dev/null +++ "b/21 \345\210\230\345\260\221\346\265\267/12 1/java3.java" @@ -0,0 +1,8 @@ +public class java3 { + public static void main(String[] args) { + int fuqin = 177; + int muqin = 165; + System.out.println("儿子"+(fuqin+muqin)*1.08/2); + System.out.println("女儿"+ (fuqin*0.923+muqin)/2); + } +} diff --git "a/21 \345\210\230\345\260\221\346\265\267/12 1/java4.java" "b/21 \345\210\230\345\260\221\346\265\267/12 1/java4.java" new file mode 100644 index 0000000..ba3d1d6 --- /dev/null +++ "b/21 \345\210\230\345\260\221\346\265\267/12 1/java4.java" @@ -0,0 +1,8 @@ +public class java4 { + public static void main(String[] args) { + int hc = 21; + int lc = 24; + boolean bo =hc*2+3==lc*2; + System.out.println(bo); + } +} diff --git "a/21 \345\210\230\345\260\221\346\265\267/12 1/java5.java" "b/21 \345\210\230\345\260\221\346\265\267/12 1/java5.java" new file mode 100644 index 0000000..309daa7 --- /dev/null +++ "b/21 \345\210\230\345\260\221\346\265\267/12 1/java5.java" @@ -0,0 +1,18 @@ +public class java5 { + public static void main(String[] args) { + int a = 24; + int b =8; + int c = 3; + int yu=16; + int disan = yu+b+c; + int disi = yu+c+c; + int diwu = yu+b+b; + int diyi =c+c+c; + int dier = b+b+b; + double yi = diyi