我有以下代码
ArrayList<Integer> Analysis = new ArrayList<>();
ArrayList<Integer> designInitialBuild = new ArrayList<>();
ArrayList<Integer> Production = new ArrayList<>();
ArrayList<Integer> Strategy = new ArrayList<>();
ArrayList<Integer> Testing = new ArrayList<>();
System.out.println("jTableLength: " + jTable1.getRowCount());
for(int xn=0;xn==jTable1.getRowCount();xn++){
System.out.println(jTable1.getModel().getValueAt(xn, 3).toString());
switch(jTable1.getModel().getValueAt(xn, 3).toString()){
case "Analysis":
Analysis.add(xn);
break;
case "Design & Initial Build":
designInitialBuild.add(xn);
break;
case "Production":
Production.add(xn);
System.out.println("Production");
break;
case "Strategy":
Strategy.add(xn);
break;
case "Testing":
Testing.add(xn);
break;
default:
System.out.println("I am Broken");
break;
}
}
System.out.println(Production.size());
当我调试代码时,它显示变量 xn 的值为 -8,它永远不会进入 for 循环,并且在我执行的循环之前执行第一个“println”,System.out.println("jTableLength: " + jTable1.getRowCount());
它显示 48 ......我是如此很困惑。