File Class (java.io.*) can represent a file, or it may be a directory (in Java, files and directories belong to this class, and the distinction is not very obvious).
The method under Java.io is to perform disk operations on the files on the disk, but the contents of the file cannot be read.
Note: Creating a File object and creating a file in Java is two different concepts. The former creates a file in the virtual machine, but does not actually create it to the OS's file system, and as the virtual machine shuts down, the created object disappears. Creating a file is really a file created in the system.
1 Package tomtexts;2Import java.util.*;3 Public classtomtexts_24 {4 Public Static voidMain (string[] args) {5Stack stack1=NewStack ();//constructs an empty stack stack16 Try {7Stack1.push (NewInteger (0));8Stack1.push (NewInteger (1));9Stack1.push (NewInteger (2));TenStack1.push (NewInteger (3)); OneStack1.push (NewInteger (4)); ASystem. out. println ((Integer) Stack1.pop ()); -System. out. println ((Integer) Stack1.pop ()); -System. out. println ((Integer) Stack1.pop ()); theSystem. out. println ((Integer) Stack1.pop ()); -System. out. println ((Integer) Stack1.pop ()); - } - Catch(Emptystackexception e) {} + - } + A}
The Java.io method is to perform disk operations on the files on the disk