Determining if a pathname is absolute

A pathname is absolute if it starts with the root.

Main.java: (on a Windows system):

import java.io.*;
 
public class Main {
   public static void main(String args[]) {
      checkAbsolute("autoexec.bat");
      checkAbsolute("c:\windows\system32\.\cloud.gif");
      checkAbsolute("//windows\..\autoexec.bat");
      checkAbsolute("\windows\..\autoexec.bat");
      checkAbsolute("windows\system32");
   }
 
   public static void checkAbsolute(String s) {
      System.out.print(new File(s).isAbsolute() ? "absolute" : "not absolute");
      System.out.println("t" + s);
   }
}

outputs:

not absolute	autoexec.bat
absolute	c:windowssystem32.cloud.gif
absolute	//windows..autoexec.bat
not absolute	windows..autoexec.bat
not absolute	windowssystem32