wat I understand is that your input1 & input2 are strings & making an "=="comparator won't work here as it compares refrences rather than the content.better use input1.equals("r") && input2.equals("g"). guess shud work.