代码(1)
public class TestFourClass 
{
public static void main(String[] args)
{
String[][] stu = new String[4][];
stu[0] = new String[6];
for (int i = 0; i < stu[0].length; i++)
stu[0][i] = "java" + (i + 1);
stu[1] = new String[3];
for (int i = 0; i < stu[1].length; i++)
stu[1][i] = "c++" + (i + 1);
stu[2] = new String[5];
for (int i = 0; i < stu[2].length; i++)
stu[2][i] = "j2me" + (i + 1);
stu[3] = new String[4];
for (int i = 0; i < stu[3].length; i++)
stu[3][i] = "嵌入式" + (i + 1);
for (int i = 0; i < stu.length; i++) 
{
switch (i) 
{
case 0:
System.out.println("java班: ");
break;
case 1:
System.out.println("c++班:");
break;
case 2:
System.out.println("j2me班:");
break;
case 3:
System.out.println("嵌入式班:");
System.out.print("   ");
}
for (int j = 0; j < stu[i].length; j++) 
{
System.out.print(stu[i][j] + "  ");
    }
System.out.println();
    }
}
}代码(2)
public class TestFourCalll
{
public static void main(String[] args)
{
String[][] stu = new String[4][];
stu[0] = new String[6];
for ( int i = 0; i < stu[0].length;i++ )
stu[0][i] = "java" + (i + 1);
stu[1] = new String[3];
for ( int i = 0; i < stu[1].length; i++ )
stu[1][i] = "c++" + (i + 1);
stu[2] = new  String[5];
for ( int i = 0; i < stu[2].length; i++ )
stu[2][i] = "J2ME" + (i + 1);
stu[3] = new String[2];
for ( int i = 0; i < stu[3].length; i++ )
stu[3][i] = "潜入式" + (i + 1);
for ( int i = 0; i < stu.length; i++ )
        {
switch (i)
{
case 0:    System.out.println("java班: ");
   break;
case 1:    System.out.println("c++班: ");
   break;
case 2:    System.out.println("J2ME班: ");
   break;
case 3:    System.out.println("潜入式班: ");
 System.out.println("   ");
     }
for ( int j = 0; j < stu[i].length; j++ )
    {
               System.out.println( stu[i][j] + "  ");   
    }     System.out.println();

}
}

解决方案 »

  1.   

    眼花了....
    直接拿compare工具比下算了..
      

  2.   

    public class TestFourCalll
    {
    public static void main(String[] args)
    {
    String[][] stu = new String[4][];
    stu[0] = new String[6];
    for ( int i = 0; i < stu[0].length;i++ )
    stu[0][i] = "java" + (i + 1);
    stu[1] = new String[3];
    for ( int i = 0; i < stu[1].length; i++ )
    stu[1][i] = "c++" + (i + 1);
    stu[2] = new  String[5];
    for ( int i = 0; i < stu[2].length; i++ )
    stu[2][i] = "J2ME" + (i + 1);              //stu[2][i] = "j2me" + (i + 1);
    stu[3] = new String[2];                    //stu[3] = new String[4];
    for ( int i = 0; i < stu[3].length; i++ )
    stu[3][i] = "潜入式" + (i + 1);            //stu[3][i] = "嵌入式" + (i + 1);
    for ( int i = 0; i < stu.length; i++ )
            {
    switch (i)
    {
    case 0:   System.out.println("java班: ");
       break;
    case 1:   System.out.println("c++班: ");
       break;
    case 2:   System.out.println("J2ME班: ");
       break;
    case 3:   System.out.println("潜入式班: ");        //System.out.println("嵌入式班:");
     System.out.println("   ");                 //System.out.print("   ");
         }
    for ( int j = 0; j < stu[i].length; j++ )
        {
                 System.out.println( stu[i][j] + "  ");   //System.out.print(stu[i][j] + "  ");
        }    System.out.println();

    }
    }注释部分是不同的,我只找到这些.
      

  3.   

    分别保存成两个文本文件,然后开始运行cmdfc 文件名1 文件名2