I want to remove 'a' and 'b' from the string but the whole string will print in the end, I do not understand what is happening in this code because the code will run properly when I use other methods.
public class Test
{
public static void main(String[] args)
{
String st = "abracadabra";
String newst = "";
int len = st.length();
for(int i=0; i<len; i++)
{
char ch = st.charAt(i);
if(ch!='a' || ch!='b')
{
newst= newst+ ch;
}
}
System.out.println(newst);
}
}