File path validation in Java
I need a help regarding file handling in Java.
I want to create a new file on windows m/c.User provides the dynamic path where we have to create the file.
Path may contains absolute path or relative path or simple file name.
I also want to display custome message if path provided by user is wrong.
Some scenarios listed here -
1) z:\ - wrong drive name it must give error message.
2) c:\NewFile.txt - correct file name with correct path should create a file.
3) c:\Testdata - exisiting folder on drive then should give the error message.
4) c:\TestData123\NewFile.txt -invalid path, folder TestData123 is not exist on drive it should give error message.
Please provide your valuable suggestions.