ZipFile getName() function in Java with examples
The getName()function is a part of java.util.zip package. The function returns the path name of the ZipFile object.
public String getName()
Parameters: The function does not require any parameters
Return value: The function returns a string, which is the path name of the zip file
Exceptions: The function does not throw any exceptions.
Below programs illustrates the use of getName() function
Example 1: Create a file named zip_file and get the name using getName() function. “file.zip” is a zip file present in f: directory.
Example 2: Create a file named zip_file and get the name using getName() function. “file1.zip” is a non-existent zip file in f: directory.
f:\file1.zip (The system cannot find the file specified)
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.