Java Path compare for sequence

Description

Java Path compare for sequence

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

public class Main {
  public static void main(String[] args) {
    Path p1 = Paths.get("C:\\myData\\Main.java");
    Path p2 = Paths.get("C:\\MyData\\main.java");

    Path p3 = Paths.get("C:\\myData\\..\\myData\\Main.java");


    int v1 = p1.compareTo(p2);
    System.out.println(v1);/*w  w  w . j  a  v a2  s .  c o m*/
    int v2 = p1.compareTo(p3);
    System.out.println(v2);
  }
}



PreviousNext

Related