国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

java關于路徑的代碼

2020-04-22 21:35 作者:小垃圾kiki  | 我要投稿
package cn.jd.server.basic;

import java.io.File;
import java.io.IOException;

public class HelloWorld {
?? ?public static void main(String[] args) throws IOException {
?? ??? ?System.out.println(System.getProperty("user.dir"));//這是得到工程的路徑
?? ??? ?String path="E:\\myjavacode\\Server_study01\\src\\cn\\jd\\server\\basic\\p.xml";
?? ??? ?File src=new File(path);
?? ??? ?System.out.println(src.getAbsolutePath());//獲得絕對路徑
//?? ??? ?System.out.println(src.getCanonicalPath());
?? ??? ?String filePath = "src/1.txt";
?? ??? ?File file = new File(filePath);
?? ??? ?System.out.println(file.exists());
?? ??? ???????? ?
?? ??? ?try {
?? ??? ??? file.createNewFile();
?? ??? ?} catch (IOException e) {
?? ??? ??? e.printStackTrace();
?? ??? ?}
?? ??? ?
?? ??? ?System.out.println(file.exists());

?? ?}
}

java關于路徑的代碼的評論 (共 條)

分享到微博請遵守國家法律
海兴县| 高碑店市| 红桥区| 漳州市| 郴州市| 沂水县| 边坝县| 临猗县| 额尔古纳市| 周口市| 习水县| 曲麻莱县| 柏乡县| 姜堰市| 喀什市| 鲜城| 东乌珠穆沁旗| 休宁县| 舒兰市| 化德县| 沅江市| 弥勒县| 永济市| 筠连县| 沭阳县| 西青区| 丁青县| 秦安县| 揭西县| 芜湖市| 双峰县| 克什克腾旗| 水城县| 呼伦贝尔市| 防城港市| 油尖旺区| 广西| 叙永县| 靖远县| 白玉县| 扬中市|