共計 240 個字符,預計需要花費 1 分鐘才能閱讀完成。
在 Java 中,可以使用 System.getProperty("user.dir")
來獲取當前工作目錄的路徑。
示例代碼如下:
public class Main {public static void main(String[] args) {String currentPath = System.getProperty("user.dir");
System.out.println("當前路徑:" + currentPath);
}
}
運行以上代碼,將輸出當前工作目錄的路徑。
丸趣 TV 網(wǎng) – 提供最優(yōu)質(zhì)的資源集合!
正文完