其他块未输入

时间:2018-06-14 19:06:25

标签: java if-statement

如何输入标记的if和else块但System.out可以正常工作? System.err不输出任何内容

                for(int i = 0; i < line.size()-2; i++)
                {
                    if(type.get(i).equals("varchar"))
                    {
                        sql += "'" + line.get(i) + "',";
                    }
                    else
                    {
                        sql += line.get(i) +",";
                    }
                }

                if (type.get(type.size()-1).equals("varchar"))
                {
                    System.err.println(line.get(type.size()-1));
                    sql += "'" + line.get(type.size()-1) + "');";
                }
                else //this one not reached
                {
                    System.err.println(line.get(type.size()-1));
                    sql += line.get(type.size()-1) + ");";
                }

                out.println(sql); //but this is executed

1 个答案:

答案 0 :(得分:1)

因为它在else语句之外。