Skip to content

Commit 0e5c44c

Browse files
committed
Java第一天
1 parent 807129e commit 0e5c44c

18 files changed

+404
-0
lines changed
2.22 MB
Binary file not shown.
429 Bytes
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class HelloWorld {
2+
public static void main(String[] args) {
3+
System.out.println("ÎÒ°®ÁÖÇàϼ");
4+
}
5+
}
420 Bytes
Binary file not shown.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//注释:用于解释说明程序的文字
2+
/*
3+
注释的分类:
4+
单行注释 一般用于解释说明单行程序
5+
格式是://注释文字
6+
多行注释 一般用于解释说明多行程序
7+
格式是:
8+
文档注释 一般是对类或者方法进行说明,被javadoc工具解析生产一个文档说明书。
9+
格式是:
10+
*/
11+
12+
//注意:多行注释不能嵌套写,而单行注释可以。
13+
14+
//这是我的学生案例
15+
//class是java中用来定义类的
16+
//定义类的格式是:class 类名
17+
18+
/*
19+
这是我的学生案例
20+
class是java中用来定义类的
21+
定义类的格式是:class 类名
22+
*/
23+
24+
/** */
25+
class Student {
26+
public static void main(String[] args) {
27+
System.out.println("我是学生");
28+
}
29+
}
Binary file not shown.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
注释的作用:
3+
A:解释说明程序,提高程序的阅读性
4+
B:可以帮助我们调试程序
5+
*/
6+
class Demo {
7+
public static void main(String[] args) {
8+
System.out.println("HelloWorld");
9+
System.out.println("我爱林青霞");
10+
System.out.println("我爱Java");
11+
System.out.println("我爱张瑜");
12+
}
13+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
需求:我要完成HelloWorld案例
3+
4+
分析:
5+
A:java语言最基本的单位是类,所以我们首先要定义一个类
6+
B:java程序要想能够独立运行,必须有主方法
7+
C:如果想要程序有输出,必须有输出语句
8+
9+
步骤:
10+
A:定义类的格式
11+
class 类名 {
12+
//类体
13+
}
14+
B:主方法的格式
15+
public static void main(String[] args) {
16+
//方法体
17+
}
18+
C:输出语句的格式
19+
System.out.println("这里的内容是可以改");
20+
21+
最后把我们的思想用代码给体现出来
22+
*/
23+
//这是我的带注释的HelloWorld案例
24+
//class用来定义类
25+
class HelloWorld {
26+
/*
27+
这是main方法
28+
main方法是程序的入口
29+
jvm会自动调用main方法
30+
*/
31+
public static void main(String[] args) {
32+
//这是输出语句
33+
System.out.println("HelloWorld");
34+
}
35+
}

day01/code/03_关键字/KeyWord.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
关键字:被Java语言赋予特定含义的单词
3+
4+
关键字的特点:关键字都是小写的
5+
6+
关键字注意事项
7+
A:goto和const作为保留字存在,目前并不使用
8+
B:类似Editplus这样的高级记事本,针对关键字有特殊的颜色标记,非常直观
9+
*/
10+
class KeyWord {
11+
public static void main(String[] args) {
12+
System.out.println("HelloWorld");
13+
}
14+
}

day01/code/04_标识符/NameDemo.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
标识符:就是给类,接口,方法,变量等起名字时使用的字符序列(字符串)
3+
4+
组成规则:
5+
A:英文字母大小写
6+
B:数字
7+
C:_和$
8+
9+
注意事项:
10+
A:不能以数字开头
11+
B:不能是Java中的关键字
12+
C:区分大小写
13+
Student,student 这是两个名称
14+
15+
常见的命名规则:见名知意
16+
A:包 其实就是文件夹,用于解决相同类名问题
17+
全部小写
18+
单级:com
19+
多级:cn.itcast
20+
21+
B:类或者接口
22+
一个单词:首字母大写
23+
Student,Person,Teacher
24+
多个单词:每个单词的首字母大写
25+
HelloWorld,MyName,NameDemo
26+
27+
C:方法或者变量
28+
一个单词:全部小写
29+
name,age,show()
30+
多个单词:从第二个单词开始,每个单词首字母大写
31+
myName,showAllStudentNames()
32+
33+
D:常量
34+
一个单词:全部大写
35+
AGE
36+
多个单词:每个单词都大写,用_连接
37+
STUDENT_MAX_AGE
38+
*/
39+
class NameDemo {
40+
public static void main(String[] args) {
41+
System.out.println("Hello World!");
42+
}
43+
}

0 commit comments

Comments
 (0)