This question already has an answer here:
- How do I compare strings in Java? 23 answers
Why does the following Code-output is everytime "false"?
public static void main(String[] args) {
Document doc;
String c = "123456";
boolean t = false;
try {
// need http protocol
doc = Jsoup.connect("http://ift.tt/1XvfAUE").get();
b = doc.toString();
b = b.replaceAll(" ", "");
b = b.substring(28,34);
System.out.print(b);
if(b == c){
t=true;
}
System.out.println(t);
}
Aucun commentaire:
Enregistrer un commentaire