Java URL getFile() MethodThe getFile() method of URL class returns the file name of the URL. The returned file portion will be the same as getPath(), plus the concatenation of the value of getQuery() if any. SyntaxParameterNA Returnsthe file name of this URL, or an empty string if one does not exist Example 1Output: Url: https://www.javatpoint.com/java-threadpoolexecutor File name in given url is : /java-threadpoolexecutor Example 2Output: Enter any url https://www.javatpoint.com/java-threadpoolexecutor File name in given url is : /java-threadpoolexecutor Example 3Output: Url1: https://www.javatpoint.com/URL-class Url2: https://www.javatpoint.com/URL-class File name in given url1 is : /URL-class File name in given url2 is : /URLConnection-class Next TopicJava URL Class |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India