{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

18 - File public String list(FilenameFilter 0bj public File...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
{ 1 列出指定类型的文件 { 可以使用 File 类的下述两个方法,列出指 定类型的文件: { public String[] list(FilenameFilter 0bj) 该方法用字符串形式返回目录下的 指定类型的所有文件。 { public File[] listFiles(FilenameFilter 0bj) 该方法用 File 对象返回目录下的指 定类型的所有文件。 { FilenameFilter 是一个接口.该接口有一 个方法: { public boolean accept(File dir String name) 当向 list 方法传递一个实 现该接口的对象时. list 方法将在列出文 件时,让该文件调用 accept 方法检查该文 件是否符合 accept 方法指定的目录和文件 名字的要求。 5.4
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
{ 2 5.1.3 删除文件和目录 { File 对象调用方法 public boolean delete() 可以删除当前对象代表的文件或 目录。 { 如果对象表示的是一个目录.则该目录必 须是一个空目录.删除成功将返回 true 5.5 5.2 使用字节流读写文件 { Java I O 流提供一条通道程序.可以
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern