jeudi 26 mars 2015

How to imitate cd command in Java

Giving you two path, one is for the original path, and another is the parameter of the cd command.


For Example:


users/documents and stackOverFlow should return users/documents/stackOverFlow


and


users/documents and ../stackOverFlow should return users/stackOverFlow


and


users/documents/test and ../../stackOverFlow should return users/stackOverFlow


How can we implement such a method imitateCDCommand with two parameters str1 and str2 and return the destination path.


Aucun commentaire:

Enregistrer un commentaire