String 文件名为字符串getParent,getName为';不是吗

String 文件名为字符串getParent,getName为';不是吗,string,filenames,String,Filenames,如何将Desktop/1.txt作为字符串获取 File f = new File("/home/jigar/Desktop/1.txt"); System.out.println(f.getParent());// /home/jigar/Desktop System.out.println(f.getName()); //1.txt 你们能解释一下你们到底想要什么吗?我想要一个字符串“Desktop/1.txt”

如何将Desktop/1.txt作为字符串获取

File f = new File("/home/jigar/Desktop/1.txt");
System.out.println(f.getParent());// /home/jigar/Desktop
System.out.println(f.getName());  //1.txt

你们能解释一下你们到底想要什么吗?我想要一个字符串“Desktop/1.txt”