I need some help with this problem - Java's startsWith() method doesn't seem to be working.
Does someone know why is this happening?
The method:
public boolean check(File f) {
boolean ans = (f.getName().startsWith(this.pre));
System.out.println(f.getName()+" "+this.pre);
System.out.println(ans);
}
The output I get is:
file5.b file
false
Same_a.txt file
false
same_name_a.txt file
false
same_name_c.txt file
false
It looks like it's always returning false.
EDIT: You were right and I misunderstood some things... thanks and sorry for the inconvinnience.