题目内容 (请给出正确答案)
执行下列方法method(),返回值为()。public int method {int num=6;if (num>8) return num;num=7
[主观题]

执行下列方法method(),返回值为()。public int method {int num=6;if (num>8) return num;num=7

执行下列方法method(),返回值为()。 public int method { int num=6; if (num>8) return num; num=7; }

A.编译出错

B.6

C.7

D.8

提问人:网友lilidong321 发布时间:2022-01-07
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
更多“执行下列方法method(),返回值为()。public i…”相关的问题
第1题
下面程序的运行结果为 #include<iostream.h> class A { int num; public: A(int i){num=i;} A(A &a) { num = a.num+ +;} void print() {cout << num;} }; void main(0 { A a (1),b (a) ; a.print(); b.

A.11

B.12

C.21

D.22

点击查看答案
第2题
有以下程序:

include

void func(int n)

{ static int num=1);

num=num+n;printf("%d",num);

}

main()

{ funo(3);func(4);printf("n"); }

程序运行后的输出结果是()。

A.4 8

B.3 4

C.3 5

D.4 5

点击查看答案
第3题

下列程序运行结果是 。 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( ) ; }

点击查看答案
第4题
函数fun的返回值是( )。 fun(char *a,char *b) int num=0,n=0; while(*(a+num))!='\0')num++; while(b[n]){ *(a+num)=b[n];num++;n++;)return num; }

A.字符串a的长度

B.字符串b的长度

C.字符串a和b的长度之差

D.字符串a和b的长度之和

点击查看答案
第5题
下列程序的输出结果是【 】

include<iostream>

using namespace std;

int main()

{

int Bum=500;

int& ref=num;

ref+=100;

cout<<num<<end1;

return 0;

}

点击查看答案
第6题
有以下程序段:

char name[20】;int num;

scanf("name=%S num=%d",name,&num);

当执行上述程序段,并从键盘输入:name=Lili mum=1001<回车>后,name的值为()。

A.Lili

B.name=Lili

C.Lili num=

D.name=Lili num=1001

点击查看答案
第7题
System类的()静态方法可以启动垃圾回收器。

点击查看答案
第8题
下列程序test类中的变量e的最后结果为( )。 public class test { public static void main (String args[]) { int a=10; int b; int c; if(a>50) { b=9; } c=b+a; } }

A.10

B.0

C.19

D.编译出错

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

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

简答题官方微信公众号

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

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

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