-
-
Save seyedsahil/90bcedefee2ed6c6034c161e1eebc71e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; | |
/** | |
* @author Seyed Sahil | |
*/ | |
public class Main { | |
public static void main(String[] args) { | |
String fileName = "movies.txt"; | |
Path filePath = Paths.get(fileName); | |
System.out.println("Path '" + filePath + "' is " + (filePath.isAbsolute() ? "absolute" : "relative")); | |
try { | |
Path realFilePath = filePath.toRealPath(); | |
System.out.println("Path '" + realFilePath + "' is " + (realFilePath.isAbsolute() ? "absolute" : | |
"relative")); | |
} catch (IOException ex) { | |
ex.printStackTrace(System.err); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment