「Java」Path.toString()のサンプル

書式
String toString()
このパスの文字列表現を返します。
使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
package com.arkgame.study.spp;
import java.nio.file.Path;
import java.nio.file.Paths;
public class PathToStrDemo {
public static void main(String[] args) {
String strA = "C:";
String strB = "study";
String strC = "arkgame.txt";
Path pt = Paths.get(strA, strB, strC);
System.out.println(pt.toString());
}
}
package com.arkgame.study.spp; import java.nio.file.Path; import java.nio.file.Paths; public class PathToStrDemo { public static void main(String[] args) { String strA = "C:"; String strB = "study"; String strC = "arkgame.txt"; Path pt = Paths.get(strA, strB, strC); System.out.println(pt.toString()); } }
package com.arkgame.study.spp;

import java.nio.file.Path;
import java.nio.file.Paths;

public class PathToStrDemo {

      public static void main(String[] args) {
            String strA = "C:";
            String strB = "study";
            String strC = "arkgame.txt";
            Path pt = Paths.get(strA, strB, strC);
            System.out.println(pt.toString());
      }

}

実行結果
C:\study\arkgame.txt

Java

Posted by arkgame