The file class of the Java io stream

Source: Internet
Author: User

http://www.verejava.com/?id=17160003163645

Import Java.io.file;import Java.io.ioexception;public class Test {public static void main (string[] args) {//Fi        Le F=file (String pathname) file F=new file ("Test.txt");            try {//Boolean createnewfile () if the file does not exist create a new empty file if there is no f.createnewfile () created;            String GetAbsolutePath ()//Gets the absolute path of the file System.out.println (F.getabsolutepath ());            String getName ()//Get file name System.out.println (F.getname ());            Long length ()//Gets the file contents byte size System.out.println (F.length ());            Boolean Renameto (file dest)//rename file F.renameto ("Rename.txt");            Boolean isfile ()//Determine if the file is System.out.println (F.isfile ());            Boolean exists ()//Determine if the file exists System.out.println (f.exists ()); Boolean delete ()//deleteExcept for document SYSTEM.OUT.PRINTLN (F.delete ());        } catch (IOException ex) {ex.printstacktrace (); }    }}

http://www.verejava.com/?id=17160003163645

The file class of the Java io stream

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.