HZAU-JAVA技術群:7435949
學習Java從零開始-見證2006-Java之路
My Links
BlogJava
首頁
新隨筆
聯系
聚合
管理
Blog Stats
Posts - 42
Stories - 0
Comments - 3
Trackbacks - 0
News
努力總是有希望的。
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(1)
給我留言
查看公開留言
查看私人留言
隨筆分類
(42)
Java(13)
(rss)
日志(29)
(rss)
隨筆檔案
(42)
2006年1月 (42)
搜索
積分與排名
積分 - 6876
排名 - 2776
最新評論
1.?re: Test_java
dasfdsafds
--sd
2.?re: import myjava.PlotOtau和import myjava.*的區別?
評論內容較長,點擊標題查看
--Allen
3.?re: import myjava.PlotOtau和import myjava.*的區別?
首先你要確認你的路徑是完全正確的
--理想
閱讀排行榜
1.?import myjava.PlotOtau和import myjava.*的區別?(397)
2.?ArrayPrint(264)
3.?StringDemo(242)
4.?夜(224)
5.?IntegerDemo(219)
6.?女孩子(211)
7.?ClassDemo(211)
8.?StringBufferDemo(207)
9.?ComplexNumber(203)
10.?CharacterDemo(198)
評論排行榜
1.?import myjava.PlotOtau和import myjava.*的區別?(2)
2.?Test_java(1)
3.?IntegerDemo(0)
4.?ClassDemo(0)
5.?ComplexNumber(0)
ArrayPrint
1
import
java.io.
*
;
2
public
class
ArrayPrint
3
{
4
private
int
N;
5
private
int
[][] intarray;
6
ArrayPrint()
7
{
8
N
=
5
;
9
intarray
=
new
int
[N][N];
10
}
11
ArrayPrint(
int
n)
12
{
13
N
=
n;
14
intarray
=
new
int
[N][N];
15
}
16
public
void
Print()
17
{
18
int
i
=
0
,j
=
0
;
19
int
i0
=
0
,j0
=
0
;
20
int
count
=
1
;
21
int
Num
=
N
-
1
;
22
while
(Num
>
0
)
23
{
24
for
(i
=
i0,j
=
j0;j
<
Num;j
++
,count
++
)
25
{
26
intarray[i][j]
=
count;
27
}
28
for
(i
=
i0;i
<
Num;i
++
,count
++
)
29
{
30
intarray[i][j]
=
count;
31
}
32
for
(j
=
Num;j
>
j0;j
--
,count
++
)
33
{
34
intarray[i][j]
=
count;
35
}
36
for
(i
=
Num;i
>
i0;i
--
,count
++
)
37
{
38
intarray[i][j]
=
count;
39
}
40
i0
++
;
41
j0
++
;
42
Num
--
;
43
}
44
if
(N
%
2
!=
0
)
45
{
46
intarray[N
/
2
][N
/
2
]
=
count;
47
}
48
for
(i
=
0
;i
<
N;i
++
)
49
{
50
for
(j
=
0
;j
<
N;j
++
)
51
{
52
String ar
=
"
0
"
;
53
if
(intarray[i][j]
/
10
<
1
)
54
{
55
ar
=
"
"
+
intarray[i][j];
56
}
57
else
if
(intarray[i][j]
/
100
<
1
&&
intarray[i][j]
/
10
>=
1
)
58
{
59
ar
=
"
"
+
intarray[i][j];
60
}
61
System.out.print(ar
+
"
"
);
62
}
63
System.out.println();
64
}
65
}
66
public
static
void
main(String[] args)
throws
IOException
67
{
68
int
order
=
0
;
69
System.out.println(
"
Please input the order of the square:(<10:)
"
);
70
order
=
System.in.read();
71
order
=
order
-
'
0
'
;
72
ArrayPrint arr
=
new
ArrayPrint(order);
73
arr.Print();
74
}
75
}
posted on 2006-01-09 18:04
Allen
閱讀(264)
評論(0)
編輯
收藏
所屬分類:
Java
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關文章:
import myjava.PlotOtau和import myjava.*的區別?
ClassDemo
ComplexNumber
ArrayPrint
StringBufferDemo
StringDemo
CharacterDemo
CalendarDemo
MathDemo
DayShower
Powered by:
BlogJava
Copyright © Allen
主站蜘蛛池模板:
汉阴县
|
南和县
|
靖远县
|
汤阴县
|
江华
|
金川县
|
盘山县
|
屯昌县
|
濉溪县
|
荔波县
|
道真
|
奉化市
|
汕头市
|
泸州市
|
新源县
|
图木舒克市
|
浦北县
|
德阳市
|
博白县
|
兖州市
|
芜湖县
|
昌图县
|
塘沽区
|
灵武市
|
玉树县
|
尉氏县
|
霍山县
|
昭苏县
|
遂平县
|
滦平县
|
临澧县
|
阿尔山市
|
富川
|
茌平县
|
双柏县
|
运城市
|
宁远县
|
敦煌市
|
威宁
|
木里
|
嘉善县
|