Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
武汉红喜
whatsmars
提交
ce03f5cd
W
whatsmars
项目概览
武汉红喜
/
whatsmars
通知
3
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
whatsmars
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ce03f5cd
编写于
8月 11, 2019
作者:
武汉红喜
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lang
上级
ba494978
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
124 addition
and
0 deletion
+124
-0
whatsmars-common/src/test/java/org/hongxi/java/util/lang/Animal.java
...ommon/src/test/java/org/hongxi/java/util/lang/Animal.java
+18
-0
whatsmars-common/src/test/java/org/hongxi/java/util/lang/Cat.java
...s-common/src/test/java/org/hongxi/java/util/lang/Cat.java
+22
-0
whatsmars-common/src/test/java/org/hongxi/java/util/lang/ChinaCat.java
...mon/src/test/java/org/hongxi/java/util/lang/ChinaCat.java
+22
-0
whatsmars-common/src/test/java/org/hongxi/java/util/lang/CodeBlockTest.java
...rc/test/java/org/hongxi/java/util/lang/CodeBlockTest.java
+31
-0
whatsmars-common/src/test/java/org/hongxi/java/util/lang/ExTest.java
...ommon/src/test/java/org/hongxi/java/util/lang/ExTest.java
+31
-0
未找到文件。
whatsmars-common/src/test/java/org/hongxi/java/util/lang/Animal.java
0 → 100644
浏览文件 @
ce03f5cd
package
org.hongxi.java.util.lang
;
/**
* @author shenhongxi 2019/8/11
*/
public
abstract
class
Animal
{
private
int
type
;
Animal
()
{
System
.
out
.
println
(
"Animal()"
);
}
Animal
(
int
type
)
{
this
.
type
=
type
;
}
abstract
void
run
();
}
whatsmars-common/src/test/java/org/hongxi/java/util/lang/Cat.java
0 → 100644
浏览文件 @
ce03f5cd
package
org.hongxi.java.util.lang
;
/**
* @author shenhongxi 2019/8/11
*/
public
class
Cat
extends
Animal
{
private
int
color
;
Cat
()
{
System
.
out
.
println
(
"Cat()"
);
}
Cat
(
int
type
,
int
color
)
{
super
(
type
);
this
.
color
=
color
;
}
@Override
void
run
()
{
System
.
out
.
println
(
"Cat#run()"
);
}
}
whatsmars-common/src/test/java/org/hongxi/java/util/lang/ChinaCat.java
0 → 100644
浏览文件 @
ce03f5cd
package
org.hongxi.java.util.lang
;
/**
* @author shenhongxi 2019/8/11
*/
public
class
ChinaCat
extends
Cat
{
private
int
province
;
ChinaCat
()
{
System
.
out
.
println
(
"ChinaCat()"
);
}
@Override
void
run
()
{
System
.
out
.
println
(
"ChinaCat#run()"
);
}
public
static
void
main
(
String
[]
args
)
{
Animal
animal
=
new
ChinaCat
();
animal
.
run
();
}
}
whatsmars-common/src/test/java/org/hongxi/java/util/lang/CodeBlockTest.java
0 → 100644
浏览文件 @
ce03f5cd
package
org.hongxi.java.util.lang
;
/**
* Created by shenhongxi on 2017/11/17.
*/
public
class
CodeBlockTest
{
int
a
=
110
;
static
int
b
=
112
;
// static CodeBlockTest instance = new CodeBlockTest(); // 这种情况输出的是2 3 1 4
static
{
System
.
out
.
println
(
"1 b="
+
b
);
// b=112
}
{
System
.
out
.
println
(
"2 a="
+
a
+
" b="
+
b
);
// a=110 b=112
}
CodeBlockTest
()
{
System
.
out
.
println
(
"3 a="
+
a
+
" b="
+
b
);
// a=110 b=112
}
public
static
void
main
(
String
[]
args
)
{
// 1 2 3 2 3 4
new
CodeBlockTest
();
new
CodeBlockTest
();
System
.
out
.
println
(
"4"
);
}
}
whatsmars-common/src/test/java/org/hongxi/java/util/lang/ExTest.java
0 → 100644
浏览文件 @
ce03f5cd
package
org.hongxi.java.util.lang
;
/**
* Created by shenhongxi on 2018/6/1.
*/
public
class
ExTest
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
t
(-
10
));
}
private
static
int
t
(
int
i
)
{
try
{
System
.
out
.
println
(
"try lock"
);
try
{
if
(
i
<
0
)
{
throw
new
RuntimeException
(
"i<0"
);
}
if
(
i
>
100
)
{
return
-
2
;
}
i
++;
}
finally
{
System
.
out
.
println
(
"release lock"
);
}
return
i
;
}
catch
(
Exception
e
)
{
return
-
1
;
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录