单项选择题

以下关于使用Java删除目录的说法中,哪一项是错误的?

A.在Java中删除目录是从虚拟机直接删除不走回收站,文件将无法恢复。
B.File类的delete()方法不允许对还有子文件的目录直接删除。
C.delete()方法可以删除一个指定的文件。
D.在删除目录时,应先删除这个目录再删除该目录下的所有文件。
点击查看答案

你可能感兴趣的试题


单项选择题

如果准备按字节读取一个文件的内容,应当使用以下哪个流?

A.FileInputStream流
B.FileReader流
C.FileOutputStream流
D.FileWriter流

单项选择题

以下关于InputStream类的read()方法的说法中,哪一项是错误的?

A.intread()方法一次能够读入一个字节。
B.intread()方法的返回值是所读入字节的数量。
C.intread(byte[]b)方法一次能够读入多个字节。
D.intread(byte[]b)方法的返回值是所读入字节的数量。

单项选择题

以下选项中,哪一项是FileInputStream的父类?

A.File
B.FileOutput
C.OutputStream
D.InputStream

单项选择题

以下选项中,哪一项不是InputStream的直接子类?

A.ByteArrayInputStream
B.FileInputStream
C.BufferedInputStream
D.PipedInputStream

单项选择题

为了向hello.txt尾加数据,下列哪一项能够正确创建指向hello.txt的流?

A.try{OutputStreamout=newFileOutputStream(“hello.txt”);}Catch(IOExceptione){}
B.try{OutputStreamout=newFileOutputStream(“hello.txt”,true);}Catch(IOExceptione){}
C.try{OutputStreamout=newFileOutputStream(“hello.txt”,false);}Catch(IOExceptione){}
D.try{OutputStreamout=newOutputStream(“hello.txt”,true);}Catch(IOExceptione){}