for(int i=0;i<a.length;i++)
{
   if(a[i]>6)
     System.out.println(a[i]+" > 6");
   else if(a[i]=6)
     System.out.println(a[i]+" = 6");
   if(a[i]<6)
     System.out.println(a[i]+" < 6");
}

解决方案 »

  1.   

    Sorry,上面少写了一个else
      
      for (int i = 0; i < a.length; i++) {
          if (a[i] > 6)
            System.out.println(a[i] + " > 6");
          else if (a[i] = 6)
            System.out.println(a[i] + " = 6");
          else if (a[i] < 6)
            System.out.println(a[i] + " < 6");
        }
      

  2.   

    else if (a[i] = 6)要改成 
    else if(a[i]==6)
    最后一句不用判断也可以。
    队列的数据结构有很多方法可以实现啊,在java.util包里有Arrays,LinkedList,Vector等等,你可以根据需要选者使用