Yes, it's wrong. It will only work on systems where file path entries are separated by backslashes. And the version with slashes instead, will only work on systems where file path entries are separated by slashes. So, both are unreliable. However...
shan raj wrote:You can construct the java.lang.File object and call the method getName() to get the file name.
This is the right way to do it.