So I have some fundamental gap in understanding.
I create Path object - Path p = Paths.get("/");
So Path is interface thereby it cannot be instantiated. But Paths.get() method has Path return type. I know it is common practice to use interface object reference. But how does it work under the hood? I thought it creates some anonymous class implementing Path interface. But the I tried to invoke .getClass() method on Path object and it returned: class sun.nio.fs.UnixPath.
Please explain briefly how does it work.