自己写的java小程序哪里错了?高手指教!

来源:百度知道 编辑:UC知道 时间:2024/06/01 05:02:34
public class shuzu
{

public static void main(String[] args)
{
int i=0,j=0,n=4;
int mat[][]=new int[4][4];
mat[0][]=mat[][0];
for(i=0;i<=3;i++)
{
for(j=0;j<=3;j++)
{mat[0][j]=mat[i][0]=1;
mat[1][j]=mat[i][1]=2;
mat[2][j]=mat[i][2]=3;
System.out.print(mat[i][j]);
}
}

}
}
本人是个刚刚开始学习java的小虾米,刚看了两章书,自己试着写了个程序,可惜报错。又不知道错在哪里,请高手指教下!
原问题是,要求输出数字形式:
0 0 0 0
0 1 1 1
0 1 2 2
0 1 2 3
请问二楼的大侠,为什么我用jcreator运的,出了一大堆乱七八遭的东西啊?以下为输出片段:我不明白啊,希望解答!一定给你分!
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available

纯算法问题,晕死我了,一定要把分给我哦。
public static void main(String[] args) {

int mat[][] = new int[4][4];
for (int i = 0; i < 4; i++) {
mat[0][i] = 0;
}
for (int i = 1; i < 4; i++) {
for (int j = 3; j >= i; j--)
mat[i][j] = mat[i - 1][j] + 1;
for (int j = 0; j < i; j++)
mat[i][j] = mat[i - 1][j];

}

for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++)
System.out.print(mat[i][j]);
System.out.println();

}
}

public static void main(String[] args) {

int mat[][] = new int[4][4];

for (int i = 0; i < 4; i++) {
mat[0][i] = 0;
}

for(int j =0;j<4;j++)
{
mat[j][0] =0;
}

for (int i = 1; i < 4; i++) {
for (int j = 1; j <4; j++)
mat[i][j] = mat[i - 1][j-1] + 1;
}

for (int i = 0; i < 4; i++) {