• 2022-05-29
    以下哪条语句可以获取文件"file.txt"的上一级目录的名字 ().
    A: String name=File.getParentName("file.txt");
    B: String name=(new File("file.txt")).getParent();
    C: String name=(new File("file.txt")).getParentName();
    D: String name=(new File("file.txt")).getParentFile();
    E: Directory dir=(new File("file.txt")).getParentDir();
    String name=dir.getName();
  • B

    内容

    • 0

      将文件file.txt的所有使用者的文件执行权限删除,以下命令中(<br/>)是错的。 A: chmod a-x file.Txt B: chmod -x file.txt C: chmod o-x file.txt D: chmod ugo-x file txt

    • 1

      下面不属于File类构造方法的是()。 A: File(String filename) B: File(String directoryPath,String filename) C: File(File f, String filename) D: File( )

    • 2

      以下代码,允许上传的文件类型有( )。<;input type="file" name="file" accept="text/*">; A: .css B: .shtml C: .txt D: .rtf

    • 3

      创建一个d盘aa文件夹下news.txt文件对象,以下正确的是 A: File file = new File("d:/aa"); B: File file = new File("d:/aa/news.txt"); C: File file = new File("d:/news.txt"); D: File file = new File("d:\aa\news.txt");

    • 4

      3.1 下面是创建File对象的语句,错误的是( ) A: File f=new File("d:\\text.txt"); B: File f=new File("d: "); C: File f=new File("d:","text.txt"); D: File f=new File("d:\text.txt");