Thread t = new Thread(); long id = t.getId(); // returns the ID of the thread
File file = new File("example.txt"); String id = file.getId(); // returns the ID of the fileIn this example, the getId() method is called on a File object to retrieve its ID. Package library: java.io.File