commit 339a4d2b05109ddb845fc68bb9e6171d5a07d700 Author: NCJOAQ <2627723488@qq.com> Date: Wed Jun 25 00:48:52 2025 +0800 提交 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f68d109 --- /dev/null +++ b/.gitignore @@ -0,0 +1,29 @@ +### IntelliJ IDEA ### +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..7d05e99 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,10 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# 依赖于环境的 Maven 主目录路径 +/mavenHomeManager.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..6f29fee --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..fabccd9 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/HM-JAVA.iml b/HM-JAVA.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/HM-JAVA.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/class1/helloworld.java b/src/class1/helloworld.java new file mode 100644 index 0000000..8428f7a --- /dev/null +++ b/src/class1/helloworld.java @@ -0,0 +1,32 @@ +package class1; +public class helloworld { +/** + * 程序的主入口点 + * @param args 命令行参数,通常用于向程序传递外部参数 + */ +public static void main(String[] args) { + System.out.println("hello world"); + helloworldf(); + System.out.println(sum(1,2)); +} + +/** + * 打印'hello world'到控制台 + * 此方法用于演示如何定义和调用一个简单的Java方法 + */ +public static void helloworldf(){ + System.out.println("hello world"); +} + +/** + * 计算两个整数的和 + * @param a 第一个加数 + * @param b 第二个加数 + * @return 两个参数的和 + * 此方法展示了如何在Java中实现基本的数学运算 + */ +public static int sum(int a,int b){ + return a+b; +} + +} diff --git a/src/class2/LiteralDemo.java b/src/class2/LiteralDemo.java new file mode 100644 index 0000000..26fb321 --- /dev/null +++ b/src/class2/LiteralDemo.java @@ -0,0 +1,23 @@ +package class2; + +public class LiteralDemo { + public static void main(String[] args) { + printLiteral(); + } + public static void printLiteral(){ + //请帮我直接输出常见的字面量 + //1.布尔型字面量,直接写 + System.out.println(true); + System.out.println(false); + //2.数字型字面量,数字之间可以有空格 + System.out.println(1); + System.out.println(1.0); + //3.字符型字面量,必须用单引号括起来,有且只一个字符 + System.out.println('a'); + //4.字符串型字面量,必须用双引号括起来,可以有多个字符 + System.out.println("hello world"); + //一些特殊字符:\n换行符 \t制表符 \r回车符 \b退格符 \f换页符 \'单引号 \"双引号 \\ 反斜杠 + + + } +} diff --git a/src/class3/VaruableDemo1.java b/src/class3/VaruableDemo1.java new file mode 100644 index 0000000..8128da2 --- /dev/null +++ b/src/class3/VaruableDemo1.java @@ -0,0 +1,34 @@ +package class3; + +import java.awt.*; + +public class VaruableDemo1 { + public static void main(String[] args) { + printLiteral(); + } + public static void printLiteral() + { + int age = 18; + System.out.println(age); + + double score = 90.0; + System.out.println(score); + + System.out.println("===================="); + + + int number = 32; + System.out.println(number); + System.out.println(number); + System.out.println(number); + System.out.println(number); + System.out.println(number); + + System.out.println("===================="); + + age = 19; + System.out.println(age); + age = age + 1; + System.out.println(age); + } +}