网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

下列程序的运行结果是______。 package ch1; import java.io. *; public class ex28 { public static void main (String args [] ) throws IOException { try { File f1 = new File("ch1\\dir28"); f1.mkdir(); File f2 = new File(f1, "file59.txt"); FileOutputStream fos = new FileOutputStream(f2); for(int i = 0; i < 2; i++) { String s= i + "times"; byte[] b = s.getBytes(); fos.write(b,0,b.length); } } catch(IOException ioe) { ioe.printStackTrace(); } } }

A.在目录ch1下建立一个目录dir28,并且建立文件file28.txt,在文件中写入"Otimes 1 times"

B.在目录ch1下建立一个目录dir28,并且建立文件file28.txt,在文件中写入“l times”

C.在目录chi下建立一个目录dir28,并且建立文件file28.txt,在文件中写入“Otimes”

D.抛出IOExceptin异常


参考答案

更多 “ 下列程序的运行结果是______。 package ch1; import java.io. *; public class ex28 { public static void main (String args [] ) throws IOException { try { File f1 = new File("ch1\\dir28"); f1.mkdir(); File f2 = new File(f1, "file59.txt"); FileOutputStream fos = new FileOutputStream(f2); for(int i = 0; i < 2; i++) { String s= i + "times"; byte[] b = s.getBytes(); fos.write(b,0,b.length); } } catch(IOException ioe) { ioe.printStackTrace(); } } }A.在目录ch1下建立一个目录dir28,并且建立文件file28.txt,在文件中写入"Otimes 1 times"B.在目录ch1下建立一个目录dir28,并且建立文件file28.txt,在文件中写入“l times”C.在目录chi下建立一个目录dir28,并且建立文件file28.txt,在文件中写入“Otimes”D.抛出IOExceptin异常 ” 相关考题
考题 下列程序的运行结果是【 】。 include class SomeClass { public: SomeClass(int va 下列程序的运行结果是【 】。include <iostream. h>class SomeClass{public:SomeClass(int value) { some_value=value;};void show_data(void) { cout<<data<<"<<~some_value<<endl; };static void set_data(int value) {data=value; }private:static int data;int some_value};int SomeClass::datavoid main(void){SomeClass my_class(1001),your_class(2002);your_class. set_data(4004);my_elass. show_data()}

考题 下列程序的运行结果是______。 include class A { public: virtual void use( ) {cou 下列程序的运行结果是______。include<iostream.h>class A{public:virtual void use( ) {cout<<"in A\n";}};class B:public A{public:virtual void use( ) {cout<<"in B\n";}};class C:public B{public:virtual void use( ){cout"in C\n";}};void main( ){A*obj;bj=new C;obj->use( );delete obj;}

考题 下列程序的运行结果是______。include class Base { public: void f(int x){cout 下列程序的运行结果是______。include<iostream.h>class Base{public:void f(int x){cout<<“Base:”<<x<<endl;});class Derived:public Base{public:void f(char*str){cout<<“Derived:”<<str<<endl;}};void main(void){Base*pd=ne

考题 下面程序的运行结果是includeclass base{protected:int a;public:base( ){cout 下面程序的运行结果是 #include<iostream.h> class base{ protected: int a; public: base( ){cout<<"0";} }; class basel:virtual base { public: base1( ){cout<<"1";} }; class base2:virtual base{ public:A.123B.3120C.312D.3012

考题 下列程序的运行结果是【 】。includeclass Sample{int a;public: Sample(int aa=0) {a 下列程序的运行结果是【 】。include<iostream, h>class Sample{int a;public:Sample(int aa=0) {a=aa;}~Sample() {cout<<"Sample="<<a<<;}class Derived: public Sample{int b;public:Derived(int aa=0, int bb=0): Sample(aa) {b=bb;}~De rived() {cout <<"Derived="<<b<<'';}void main(){Derived dl (9)}

考题 下面程序的结果是 ______。includeclass A{ public:virtual voidfun()=0{};};class 下面程序的结果是 ______。 #include<iostream.h> 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"<< " " } }; class D: public A{ public: void fun () {cout<< "save file\n" ;} }; void main() { A a,*p; B b; C c; D d; p=c; p->fun (); p=b; p->fun (); p=d; p->fun(); }A.new file open file save fileB.new file new file new fileC.编译出错D.open file new file save file

考题 下列程序的运行结果是______。 include class Base { public: virtual void func(int 下列程序的运行结果是______。include<iostream.h>class Base{public:virtual void func(int i){cout<<"class Base:"<<i<<end1;)};class Derived: public Base{public:void func(double d){cout<<"class Derived:"<<d<<endl;}};void main( ){Base a,*p=a;Derived b;p=b;(*p).func(3.3);}

考题 对于一个Java源文件,包含三个顶级元素,它们正确的书写顺序是()。A.package,import,classB.class,import,packageC.import,package,classD.package,class,import

考题 对于一个Java源文件,包含三个顶级元素,它们正确的书写顺序是()。A.class,import,packageB.import,package,classC.package,import,classD.package,class,import

考题 在一个Java源程序中,如果import语句、package语句、class语句都存在,则出现的次序应为()A.import先出现,package和class出现的次序随意B.class语句、import语句、package语句C.package语句、import语句、class语句D.package语句、class语句