提交
This commit is contained in:
29
.gitignore
vendored
Normal file
29
.gitignore
vendored
Normal file
@@ -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
|
||||
10
.idea/.gitignore
generated
vendored
Normal file
10
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# 依赖于环境的 Maven 主目录路径
|
||||
/mavenHomeManager.xml
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
6
.idea/misc.xml
generated
Normal file
6
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/HM-JAVA.iml" filepath="$PROJECT_DIR$/HM-JAVA.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
11
HM-JAVA.iml
Normal file
11
HM-JAVA.iml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
32
src/class1/helloworld.java
Normal file
32
src/class1/helloworld.java
Normal file
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
23
src/class2/LiteralDemo.java
Normal file
23
src/class2/LiteralDemo.java
Normal file
@@ -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换页符 \'单引号 \"双引号 \\ 反斜杠
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
34
src/class3/VaruableDemo1.java
Normal file
34
src/class3/VaruableDemo1.java
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user