题目内容 (请给出正确答案)
下列程序的运行结果是【 】。 include <iostream. h> class test { private: int num; public: tes
[主观题]

下列程序的运行结果是【 】。 include <iostream. h> class test { private: int num; public: tes

下列程序的运行结果是【 】。

include <iostream. h>

class test

{

private:

int num;

public:

test()

int TEST() {return num+100;}

~test()

};

test::test(){num=0;}

test::~test(){cout<<"Destructor is active"<<endl;}

void main()

{

test x[3]

cout<<x[1]. TEST()<<endl;

}

提问人:网友xinxueff 发布时间:2022-01-06
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
更多“下列程序的运行结果是【 】。 include <iostre…”相关的问题
第1题
下列程序的输出结果为: class generalFunction{ public static int add(int x,int y){ return x+y; } //静态方法 } public class StaticFunTest{ public static void main(String[] args){ int c=generalFunction.add(7, 8); System.out.print("7 + 8 = " + c+ “, “); generalFunction fun=new generalFunction(); int d= fun.add(5, 8); System.out.println("5 + 8 = " + d); } }
点击查看答案
第2题

下列程序的输出结果为 class Box{ int length,width,height; public void setInfo(int l,int w,int h){ length = l; width = w; height = h; } public int volumn(){ return length*width*height; } public int area(){ return (length*width + length*height + width*height) * 2; } public String toString(){ return "Length:" + length + " width:" + width + " height:" + height + " volumn: " + volumn() + " area:" + area(); } } public class BoxTest { public static void main(String[] args) { Box b = new Box(); b.setInfo(5,2,4); System.out.println(b.toString()); } }

点击查看答案
第3题
下列程序段执行后的结果是? String s = new String( "World!" ); System.out.println( s.length() );

A、6

B、4

C、5

D、3

点击查看答案
第4题
下面程序运行的结果是: public class test { private ArrayList Names = new ArrayList(); public test(string[] names) { foreach (string name in names) this.Names.Add(name); } public string this[int index] { get { return Names[2*index+1].ToString(); } } static void Main() { String[] names = new string[] { "A", "B", "C", "D" }; test t = new test(names); Console.WriteLine(t[1]); } }

A、A

B、B

C、C

D、D

点击查看答案
第5题
1、请阅读下面的程序,选择正确的运行结果。( ) class Demo{ private static int x ; public static void main(String[] args){ System.out.println(x++); } }

A、A.0

B、B.1

C、C.无结果

D、D.编译失败

点击查看答案
第6题
public class Test01 { public static void main(String[] args) { try { int x = 2 / 0; System.out.println(x); } catch (Exception e) { System.out.println("进入catch代码块"); } finally { System.out.println("进入finally代码块"); } } } 此程序能通过编译,输出的结果为:进入catch代码块。
点击查看答案
第7题
下列程序运行结果是 。 class B1 {public: B1(int i) {cout<<"constructing b1>< <endl;} }; b2 {public: b2(int j) b3 c: public b2, b1, { public: c(int a, int b, c, d): b1(a),memberb2(d),memberb1(c),b2(b) {} private: b1 memberb1; memberb2; memberb3; void main() c obj(1,2,3,4);>
点击查看答案
第8题
给定java 代码,如下,编译运行后,结果是( )。 public class Test{ static String s; public static void main(String args[]) { char c=s.charAt(0); System.out.println(c); } }

A、编译错误

B、运行期异常,异常类型为NullPointerException

C、运行期异常,异常类型为ArithmeticExceptioin

D、正确运行,但无输出内容

点击查看答案
第9题
设有如下程序: public class Test5 { public static void main (String args []) { /* This is the start of a comment if (true) { Test5 = new test5(); System.out.println("Done the test"); } /* This is another comment */ System.out.println ("The end"); } } 结果为?

A、输出 "Done the test".

B、程序输出"The end"

C、程序编译错误.

D、程序输出"Done the test"和 "The end"

点击查看答案
第10题
复数类定义如下: class Complex { private: float real;//实部 float img; //虚部 public: Complex (float x=0, float y=0){real=x, img=y;} Complex (Complex &c){real=c.real; img=c.img;} }; 若 Complex c1(3, 5); //A Complex c2; //B Complex c3(c1); //C c2=c1; //D 则下列说法正确的是()。

A、A行调用了拷贝构造函数

B、B行调用了拷贝构造函数

C、C行调用了拷贝构造函数

D、D行调用了拷贝构造函数

点击查看答案
账号:
你好,尊敬的用户
复制账号
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
欢迎分享答案

为鼓励登录用户提交答案,简答题每个月将会抽取一批参与作答的用户给予奖励,具体奖励活动请关注官方微信公众号:简答题

简答题官方微信公众号

警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

微信搜一搜
简答题
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反简答题购买须知被冻结。您可在“简答题”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
简答题
点击打开微信