我在if条件下比较字符串并在if条件中打印selectedradbtn的值。这里 selectedradbtn 在if条件中打印...但是当我打印之前如果条件值正在打印...
我的代码:
ArrayList<String> array2;
static int selectedradbtn;
selectedradbtn = Previouspage.selectedradiobtn;
System.out.println("selected radio button outside if"+selectedradbtn); //here value is printing
if(Integer.toString(selectedradbtn).equals(array2.get(0)) && array2.get(3).equals("1") )
{
System.out.println("selected radio button in if"+selectedradbtn); //value not printing
correct = correct+ 1;
System.out.println("correct if"+correct);
}
我哪里错了...请帮我解决这个问题...... 提前谢谢......
答案 0 :(得分:0)
不确定,但这有帮助吗
selectedradbtn = Previouspage.selectedradiobtn;
System.out.println("selected radio button outside if"+selectedradbtn); //here value is printing
if((Integer.toString(selectedradbtn).equals(array2.get(0)) && (array2.get(3).equals("1")))
{
System.out.println("selected radio button in if"+selectedradbtn); //value not printing
correct = correct+ 1;
System.out.println("correct if"+correct);
}
答案 1 :(得分:0)
添加其他{}并检查您的情况是否满足。