• 2021-04-14
    使用File file=new File("c:myletter
  • letter.txt")创建一个文件对象()

    内容

    • 0

      下列写法错误的是 A: File f = new File ("a.txt"); B: File f = new File ("d:\\a.txt"); C: FileInputStream fis = new FileInputStream (new File ("a.txt")); D: FileOutputStream fos = new FileOutputStream ( File ("."));

    • 1

      对于存放在D盘的vb文件夹下的文件cj.dat,创建该文件的File类对象的语句,正确的是()。 A: File f=new File("d:\\vb\\cj.dat"); B: File f=new File("d:/vb","cj.dat"); C: File f=new File("d:/vb/cj.dat"); D:File f=new File(" D: File f=new File("d:\\vb","cj.dat");

    • 2

      以下哪个语句可以在窗口中为c:\temp.txt创建一个File实例。() A: new<br/>File("c:\temp.txt") B: new<br/>File("c:\\temp.txt") C: new<br/>File("c:/temp.txt") D: new<br/>File("c://temp.txt")

    • 3

      下面程序的运算结果是( )。 #include<iostream> using namespace std; class A { public: virtual void fun()=0; }; class B:public A } public: void fun() {cout<<"new file"<<" ";} }; class C:public A { public: void fun() { cout<<"open file"<<" ";} }; void main() { A a, * p; B b;C c; p=&c; p->fun(); p=&b; } A: new file open file B: new file new file C: 编译出错 D: open file new file

    • 4

      File file=new file(“a.txt”);其中 a.txt这个文件必须存在。 A: 正确 B: 错误