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)
搜索
積分與排名
積分 - 6956
排名 - 2768
最新評論
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.*的區別?(399)
2.?ArrayPrint(266)
3.?StringDemo(245)
4.?夜(226)
5.?IntegerDemo(220)
6.?ClassDemo(214)
7.?女孩子(212)
8.?StringBufferDemo(208)
9.?ComplexNumber(206)
10.?CharacterDemo(200)
評論排行榜
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
閱讀(266)
評論(0)
編輯
收藏
所屬分類:
Java
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關文章:
import myjava.PlotOtau和import myjava.*的區別?
ClassDemo
ComplexNumber
ArrayPrint
StringBufferDemo
StringDemo
CharacterDemo
CalendarDemo
MathDemo
DayShower
Powered by:
BlogJava
Copyright © Allen
主站蜘蛛池模板:
都兰县
|
广汉市
|
通许县
|
武陟县
|
横峰县
|
金昌市
|
奈曼旗
|
巩义市
|
镇康县
|
蒙自县
|
定结县
|
通化市
|
农安县
|
衢州市
|
濮阳市
|
通城县
|
青岛市
|
余庆县
|
恩施市
|
宜章县
|
枞阳县
|
天长市
|
左权县
|
丽江市
|
贵港市
|
阿拉善左旗
|
会昌县
|
彰化市
|
阳春市
|
缙云县
|
安龙县
|
东乌珠穆沁旗
|
喀喇沁旗
|
隆德县
|
文安县
|
定安县
|
天峻县
|
桃园市
|
榆树市
|
郴州市
|
邛崃市
|