Using || in while loop
This is only sample code.My point is to make: 'If Hello OR foo word is
found, do something'.But while loop does not react, even if both strings
are in text.If I use only one condition without || while loop does what I
expect.How cant I fix this? Thank you!
public void start(){
Document doc=Jsoup.connect("http://www.yahoo.com").get();
String text=doc.text();
while(!text.contains("Hello")||!text.contains("foo"))
System.out.println("Not found.");
}
}
No comments:
Post a Comment