dcsimg
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java
Expertise: Intermediate
Jan 2, 2020

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


How to Join (Combine) Fix File Paths

In order to join (combine) fix file paths we can use Path#resolve() and Path#resolveSibling():.

// using Path#resolve()
Path base1 = Paths.get("D:/learning/books");        
Path path1 = base1.resolve("Java.pdf");

// using Path#resolveSibling()
Path base2 = Paths.get("D:/learning/books/Java.pdf");
Path path3 = base2.resolveSibling("PHP.pdf");
Octavia Anghel
 
Thanks for your registration, follow us on our social networks to keep up-to-date