Test.java Source code

Java tutorial

Introduction

Here is the source code for Test.java

Source

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

public class Test {
    public static void main(String[] args) {
        Path path1 = Paths.get("/home/docs/users.txt");
        Path path2 = Paths.get("/home/docs/users.txt");
        Path path3 = Paths.get("/home/music/A.mp3");

        testEquals(path1, path2);
        testEquals(path1, path3);
    }

    private static void testEquals(Path path1, Path path2) {
        if (path1.equals(path2)) {
            System.out.println("equal");
        } else {
            System.out.println("NOT equal");
        }
    }
}