Hello everyone, i'm juz started learning java programming and i'm having a problem with my code for my project.
i cannot understand y my indexOf() returns me 2 result..
here is a example:
String ys = "</book><book></book>";
if(ys.indexOf("<book>", 0) != -1){
System.out.println("Valid");
} else {
System.out.println("Invalid");
}
the result i get is:
Valid
Valid
How come it print out twice?