URL getFile Example
URL class getFile example. This example shows you how to use getFile method.
URL class getFile example. public String getFile() Gets the file name of this URL. The returned file portion will be the same as getPath(), plus the concatenation of the value of getQuery(), if any. If there is no query portion, this method and getPath() will return identical results.
Here is ther code
/*
* @ # getFile.java
* A class repersenting use to getFile method
* of URL class in java.net package
* version 23 June 2008
* author Rose India
*/
import java.net.*;
public class getFile {
public static void main(String args[]) throws Exception {
URL url = new URL("http://localhost:8080/programs/index.html");
System.out.println(url.getFile());
}
} |
|