首页/ 题库 / [单选题]关于下面程序,( )的结论是正确的。 p的答案

关于下面程序,( )的结论是正确的。 public class J_Test { public static void main(String[] args) { try { return; } finally { System.out.println("1"); }

单选题
2021-07-17 17:50
A、上面程序含有编译错误
B、上面程序在运行时会产生一个运行时异常
C、上面程序会正常运行,但不产生任何输出
D、上面程序输出“1”
查看答案

正确答案
D

试题解析

标签:
感兴趣题目
阅读下面程序 public class MyVal { public static void main(String[]args) { MyVal m=new MyVal(); m.amethod(); } public void amethod() { boolean b[]=new Boolean[5]; } } 程序编译或运行的结果是
阅读下面程序 class Test implements Runnable { public static void main(String[] args) { Test t=new Test(); t.start(): } public void run() {} } 下列关于上述程序的叙述正确的是
阅读下面程序 public class Test implements Runnable { public static void main(String[] args) { ______ t.start(); } public void run() { System.out.println("Hello!"); } } 程序中下画线处应填入的正确选项是
下面程序的运行结果为( )。 #include <iostream> using namespace std; class A{ public: A(){cout<<" ";} ~A(){cout<<" ";} } class B:public A{ public: B(){cout<<" ";} ~B(){cout<<" ";} } void main(){ B b; }
下面程序的结果是 #include<iostream.h> class A { public: A( ) {cout<<"construtA"<<endl;} virtual~A( ) {cout<<"destructA"<<endl;}}; class B:public A {}; class C:public A {}; c
下面程序的结果是( )。 #include<iostream.h> class A { int a; public: A():a(1){} void showa(){cout<<a;} }; Class B { int a; public: B():a(2){} void showa(){cout<<a;} ); class C:public A,public B { int a; pu
下面程序的输出结果是( )。 #include <iostream> using namespace std; class A { public: A( ) {cout<<"A";} } class B { public: B() {coat<<"B" ;} } class C: public A { public: B b; C() {cout<<"C";} } void mian(){ C c; }
编译下面源程序会得到哪些文件( )? Class A4{ } Class A2{ } public class B{ public static void main(String args[ ]){ } }
对于类定义: class A{ public: virtual void funcl(){} void func2(){} ); class B:public A{ public: voidfuncl(){cout<<“class Bfunc 1”<<endl;} virtual void func2(){cout<<“class B func 2”<<endl;} }; 下面正确的叙述是( )。
下面程序的运行结果是 #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:
下面程序的运行结果是( )。 #include<iostream.h> class base{ protected: int a; public: base(){cout<<“0”;} }; Class basel:Virtual base{ public: basel(){cout<<“1”;} }; Class base2:virtual base{ public: base2(){cout<<“2”;)
下面程序输出的结果为 #include"iostream.h” class A { public: A(){cout<<"CLASSA"<<endl;} ~A() {} }; class B:public A { public: B(){cout<<"CLASS B"<<endl;} ~B(){} }; void main() { A*p; p=new B;
相关题目
关于下面程序,( )的结论是正确的。 class J_SubClass extends J_Test { }public class J_Test { J_Test(int i) { System.out.println(i); }ublic static void main(String[] args) { J_SubClass a = new J_SubClass();
关于下面程序,( )的结论是正确的。 public class J_Test { public static void main(String[] args) { try { return; } finally { System.out.println("1"); }
关于下面程序,( )的结论是正确。 public class J_Test { public static void main(String[] args) { int[] a = new int[5]; boolean[] b = new boolean[5]; System.out.println(a[4]); System.out.println(b[5]); }
给出下面代码,关于该程序以下哪个说法是正确的? ( )public class Person(){static int arr[] = new int[5];public static void main(String a[]){System.out.println(arr[0]); }}
对于类定义: class A{ public: virtual void funcl(){} void func2(){} ); class B:public A{ public: voidfuncl(){cout<<“class Bfunc 1”<<endl;} virtual void func2(){cout<<“class B func 2”<<endl;} }; 下面正确的叙述是( )。
下面程序的结果是( )。 #include<iostream.h> class A { int a; public: A():a(1){} void showa(){cout<<a;} }; Class B { int a; public: B():a(2){} void showa(){cout<<a;} ); class C:public A,public B { int a; pu
阅读下面程序 public class MyVal { public static void main(String[]args) { MyVal m=new MyVal(); m.amethod(); } public void amethod() { boolean b[]=new Boolean[5]; } } 程序编译或运行的结果是
阅读下面程序 public class Test implements Runnable { public static void main(String[] args) { ______ t.start(); } public void run() { System.out.println("Hello!"); } } 程序中下画线处应填入的正确选项是
下面程序的运行结果为( )。 #include <iostream> using namespace std; class A{ public: A(){cout<<" ";} ~A(){cout<<" ";} } class B:public A{ public: B(){cout<<" ";} ~B(){cout<<" ";} } void main(){ B b; }
下面程序的运行结果为 #include<iostream.h> class A { public: A( ){cout<<"1";} ~A( ){cout<<"2";} }; class B:public A { public: B( ){cout<"3";} ~B( ){cout<<"4";} }; void main( ) { B
下面程序的运行结果为 #include<iostream,h> class A { public: A(){cout<<"1";} ~A(){cout<<"2";} }; Class B:public A { public: B(){cout<<"3";} ~B(){cout<<"4";} }; void main() { B b; }
下面程序的结果是 #include<iostream.h> class A { public: A(){cout<<"construtA" <<endl;} virtual ~A() {cout << "destructA" <<endl;}}; class B:public A { }; class C:public A { }; class D:public B,public C { }; void main() { Dd;}
给出下面代码,关于该程序以下哪个说法是正确的?( ) public class Person{ static int arr[] = new int[5]; public static void main(String a[]) { System.out.println(arr[0]); } }
若有以下程序: #include <iostream> using namespace std; class A { protected: int a; public: A() { a=10; } }; class A1 : public A { public: A1() { a=a+1; } }; class A2 : public A { public: A2 () { a=a+2; } }; class B : public A1,public A2 { public: B(){} void print() { cout<<a<<end1; } }; int main ( ) { B obj; obj.print(); return 0; } 程序运行后的输出结果是( )。
下面程序的结果是 #include<iostream.h> class A { public: A(){cout<<"construtA" <<endl;} virtual ~A() {cout << "destructA" <<endl;}}; class B:public A { }; class C:public A { }; class D:public B,public C { }; void main() { Dd;}
有如下程序: #include <iostream.h> class x { protected: int a; public: x() { a=1; } }; class x1 : virtual public x { public: x1() { a+=1; cout<<a; } }; class x2 : virtual public x { public: x2() { a+=2; cout<<a; } }; class y : public xl,public x2 { public: y() { cout<<a<<end1; } }; int main() { y obj; return O; } 该程序运行后的输出结果是( )。
下面程序的运行结果为 #include<iostream.h> class A { public: A( ){cout<<"1";} ~A( ){cout<<"2";} }; class B:public A { public: B( ){cout<"3";} ~B( ){cout<<"4";} }; void main( ) { B
下面程序的运行结果为 #include<iostream,h> class A { public: A(){cout<<"1";} ~A(){cout<<"2";} }; Class B:public A { public: B(){cout<<"3";} ~B(){cout<<"4";} }; void main() { B b; }
编译下面源程序文件会得到的文件是( )。 class A1 {} class A2 { public class B { public static void main(String args[]) {} }}
下面程序的运行结果是 #include<iostream.h> class base{ protected: int a; public: base(){cout <<"0";} }; class basel:virtual base{ public: basel () {cout <<"1";} }; class base2:virtual base{ public: base2(){cout <<"2";} }; class derived:public basel,public base2{ public: derived(){cout <<"3";} }; void main() { derived obj; cout <<end1; }
广告位招租WX:84302438

免费的网站请分享给朋友吧