搜题
网友您好,请在下方输入框内输入要搜索的题目:
搜题
题目内容 (请给出正确答案)
提问人:网友fmcming 发布时间:2022-01-07
[主观题]

下列程序的运行结果是 。 class Stack{ char * sp ; public : Stack(){ sp = new char[100] ; st

下列程序的运行结果是 。 class Stack{ char * sp ; public : Stack(){ sp = new char[100] ; strcpy(sp , "I love China") ; cout << "在构造函数中! \n" ; } ~Stack(){ cout << sp << endl ; delete [ ]sp ; cout << "在析构函数中! \n" ; } } ; void main() { Stack s ; }

简答题官方参考答案 (由简答题聘请的专业题库老师提供的解答)
  抱歉!暂无答案,正在努力更新中……
更多“下列程序的运行结果是 。 class Stack{ char * sp ; public : Stack(){ sp = new char[100] ; st”相关的问题
第1题
请写出程序运行结果。 public class E { public static void main(String[] args) { Com com = (a,b)->{return a-b;}; System.out.println(com.get(10,20)); } } interface Com{ int get(int a,int b); }
点击查看答案
第2题

下列程序运行结果是 。 class test{ long x; static int num; public: test (long m=0) {x=m;} test operator++(); test operator++(int); void Show() { cout<<"the num is:> <<",x="<> < <endl; } }; test test::operator++() { ++x; num is: the answer"> 参考答案: <span style="color:rgb(255, 0, 0)">The num is: 1,x=1 The num is: 2,x=3 The num is: 3,x=3 The num is: 3,x=1</span>

2、下列程序运行结果是 。 #include <iostream.h> class A { long x; public: A(long m) {x=m;} void Show() { cout<<"count="<> <<",x="<> < <endl; } a& operator++(); operator++(int); static int count; }; a::operator++() { ++x; ,x="&lt;&lt;x&lt;&lt;endl; A temp(*this); x++; return temp; } int A::count=1; void main() { A a(1); a.operator++(1); a.operator++(); a.Show(); }&lt;br/&gt;&lt;p class=" count="&lt;&lt;count++&lt;&lt;" answer"> 参考答案: <span style="color:rgb(255, 0, 0)">count=1,x=1 count=2,x=3 count=3,x=3</span>

3、下列程序运行结果是 。 class sample{ int x , y ; public : sample( ) { x=y=0 ; } sample( int i , int j) {x=i ; y=j ; } void copy( sample &obj) { *this=obj ; } sample operator--( ) { x-- ; y-- ; return *this; } void print( ){ cout << x << " " << y<< " " ; } } ; void main( ) { sample c1(1 , 2) , c2 ; --c1; c1.print( ) ; c2.copy(c1) ; --c2; c2.print( ) ; }

点击查看答案
第3题
请阅读下面的程序,写出最终的结果: interface Inter { public void show(); } abstract class AbstractInter implements Inter { public void show() { System.out.println("AbstractInter show()"); } } class InterImpl extends AbstractInter { public void show() { System.out.println("InterImpl show()"); } } public class InterImplTest { public static void main(String[] args) { InterImpl i = new InterImpl(); i. show(); } }
点击查看答案
第4题
下列程序的输出结果是()。 Public class Test{ Public static void main(String[]args){ int[]array=(2,4,6,8,10); int size=6; int result=-l: try{ for(int i=0;i

A.Catch---1

B.Catch---2

C.Catch---3

D.以上都不对

点击查看答案
第5题
请将下列栈类Stack的横线处补充完整。

class Stack{

private:

int pList[100]; ∥int数组,用于存放栈的元素

int top; ∥栈顶元素(数组下标)

public:

Stack():top(0){}

void Push(const int &item); ∥新元素item

点击查看答案
第6题
分析下列程序中类MyClass的定义class BaseClass{publicinti;}classMyClass:BaseClass//继承BaseClass{publicnewinti;}则下列语句在Console上的输出为_______.()MyClassy=newMyClass();BaseClassx=y;//父类指针x指向子类对象x.i=100;//操作父类i Console.WriteLine("{0},{1}"

A、0,0

B、100,100

C、0,100

D、100,0

点击查看答案
第7题
下面代码的运行结果是 public class Test{ public static void main(String[] args){ int[] a=new int[3]; int[] b= new int[]{1,2,3,4,5}; a=b; for(int i=0; i<b.length; i++){ system.out.print(a[i]+" "); }> A、程序报错

B、1 2 3

C、1 2 3 4 5

D、0 0 0

点击查看答案
第8题
下列程序中( )【代码】是错误的。 public class TestValue { int x = 100; 【代码1】 static long y = 200; 【代码2】 public void f() { y = 300; 【代码3】 } public static void g() { x = -23; 【代码4】 } }

A、【代码1】

B、【代码2】

C、【代码3】

D、【代码4】

点击查看答案
第9题
试图编译和运行以下代码的结果是什么?class Base { void f(int i) {System.out.println("int"); } void f(double d) {System.out.println("double");} } public class Fin extends Base { void f(String s) { System.out.println("String"); } public static void main(String argv[]){ Fin a = new Fin(); a.f(10); } }

A、无法编译,因为Fin里只有接受String的f()

B、无法编译,因为Fin里的f()和Base类的两个f()都无法构成override关系

C、编译通过,打印出String

D、编译通过,打印出int

点击查看答案
第10题
下列代码的执行结果是()。 public class Expression{ public static void main(String arga[](Int vl=10,v2=99,v3=0; System.Out.prIntln((vl

A.9.9

B.3

C.false

D.true

点击查看答案
重要提示: 请勿将账号共享给其他人使用,违者账号将被封禁!
查看《购买须知》>>>
重置密码
账号:
旧密码:
新密码:
确认密码:
确认修改
购买搜题卡查看答案
购买前请仔细阅读《购买须知》
请选择支付方式
微信支付
支付宝支付
点击支付即表示你同意并接受《服务协议》《购买须知》
立即支付
搜题卡使用说明

1. 搜题次数扣减规则:

功能 扣减规则
基础费
(查看答案)
加收费
(AI功能)
文字搜题、查看答案 1/每题 0/每次
语音搜题、查看答案 1/每题 2/每次
单题拍照识别、查看答案 1/每题 2/每次
整页拍照识别、查看答案 1/每题 5/每次

备注:网站、APP、小程序均支持文字搜题、查看答案;语音搜题、单题拍照识别、整页拍照识别仅APP、小程序支持。

2. 使用语音搜索、拍照搜索等AI功能需安装APP(或打开微信小程序)。

3. 搜题卡过期将作废,不支持退款,请在有效期内使用完毕。

请使用微信扫码支付(元)

订单号:

遇到问题请联系在线客服

请不要关闭本页面,支付完成后请点击【支付完成】按钮
遇到问题请联系在线客服
恭喜您,购买搜题卡成功 系统为您生成的账号密码如下:
重要提示:请勿将账号共享给其他人使用,违者账号将被封禁。
发送账号到微信 保存账号查看答案
怕账号密码记不住?建议关注微信公众号绑定微信,开通微信扫码登录功能
警告:系统检测到您的账号存在安全风险

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

- 微信扫码关注简答题 -
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反简答题购买须知被冻结。您可在“简答题”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
- 微信扫码关注简答题 -
请用微信扫码测试
欢迎分享答案

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

简答题官方微信公众号

简答题
下载APP
关注公众号
TOP