I want to split a string in the first space it has, but when I try to use the splited string in the condition "if" it doesn't work.
String parentName = new String();
String[] fullName = a.getPathComponent(1).toString().split("\\s+"); //also try with split (" ");
parentName = fullName[0];
if (parentName == "DBPedia"){
...
}
for example, fullName will take the string "DBPedia (23)", and the splited string "parentName" will have only the string "DBPedia", but when I use the string on the "If" it does not enter to the condition. What can be the problem?