题目内容 (请给出正确答案)
[主观题]

以下C#程序的执行情况是()。using System; namespace aaa { delegate void delep(int i); class

以下C#程序的执行情况是()。using System; namespace aaa { delegate void delep(int i); class Program { public static void Main() { funb(new delep(funa)); } public static void funa(int t) { funb(21); } public static void funb(int i) { Console.WriteLine(i.ToString()); } } }

A、代码中存在错误,delegate void delep(int i);不能定义在名称空间或者类之外

B、代码中存在错误,代码行funb(new delep(funa))使用委托错误

C、程序正常运行,输出为0

D、程序正常运行,输出为21

提问人:网友Litlay 发布时间:2022-01-07
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
更多“以下C#程序的执行情况是()。using System; n…”相关的问题
第1题
以下程序的输出结果是( )。using System; using System.Collections; namespace aaa { class Example1 { static void Main() { int s = 0; int[][] a = new int[2][]; //交错数组 a[0] = new int[3] { 1, 2, 3 }; a[1] = new int[4] { 4, 5, 6, 7 }; for (int i = 0; i < a.Length; i++) for (int j = 0; j < a[i].Length; j++) s += a[i][j]; Console.WriteLine(s); } } }

A、1

B、6

C、22

D、28

点击查看答案
第2题
以下程序有没有错误?

class Something {

int i;

public void doSomething(){

System.out.printin("i="+i);

)

}

点击查看答案
第3题
以下程序的运行结果为 class test { public static void main(String args[]) { int x=2; System.out.printf("%d,%d,%d", x++ , x, ++x); } }

A、3,3,3

B、2,3,4

C、2,2,3

D、3,3,4

点击查看答案
第4题
【单选题】在JAVA中,以下程序的输出结果是 class Tetromino{ public void print(){ System.out.println(“打印四个格子所在的坐标”); } } class TetrominoT extends Tetromino { public void print(){ System.out.println(“打印TetrominoT”); } } class Test1 { public static void main(String[] args){ Tetromino t = new TetrominoT(); t.print(); } }

A、打印四个格子所在的坐标

B、打印TetrominoT

C、打印四个格子所在的坐标 打印TetrominoT

D、以上都不对

点击查看答案
第5题
下列程序段的运行结果为( )。 public class Test{ public static void foo(int i){ try{ if(i==1){ throw new Exception(); } System.out.print("1"); }catch(Exception e){ System.out.print("2"); }finally{ System.out.print("3"); } System.out.print("4"); } public static void main(String[] args){ foo(1); } }

A、123

B、234

C、1234

D、编译失败

点击查看答案
第6题
下列程序的执行结果是______。 class T5 implements Runnable { public void run() { int i = 0; While(i<2) { Thread t = Thread.currentThread(); System.out.println(i + t.getName()); i++ } } } public class Testl6 { public static void main(String[] args) { Thread t1 = new Thread(new T5(), "TS"); t1.start (); Thread t = Thread.currentThread(); for(int i = 0; i<3; i++) { System.out.println(I + t.getName()); if(i == 1 && t1.isAlive()) t.yield(); } } }

A.Omain lmam 0T5 1T5 2main

B.Omain lmam 2main

C.Omain lmain 2main 0T5 1T5

D.Omain lmain 0T5 1T5

点击查看答案
第7题
【填空题】请写出以下程序运行结果: public class Main { public Main() { System.out.print("main "); } public Main(String s) { this(); System.out.print("main with "+s); } public static void main(String[] args) { Main main = new Main("wow"); } }
点击查看答案
第8题
以下程序的执行结果是什么?()

int[] myArray=new int[3];try{ for (int i=0; i<= myArray.length; i++){ myArray[i]=i*3 ; System.out.println("myArray 数组的第"+ i +"个元素的值是"+myArray[i]); }} catch (ArrayIndexOutOfBoundsException e) { System.out.println("数组下标越界");}

A、程序出现异常,屏幕提示“数组下标越界”

B、程序执行,显示数组中每个元素的值,最后显示“数组下标越界”

C、程序正常执行结束,屏幕上显示数组中每个元素的值

D、程序编译出错

点击查看答案
第9题

用语言描述下面的程序:using System; using System.Collections.Generic; using System.Text; namespace Graph { class Program { static void Main(string[] args) { circular c = new circular(); Console.WriteLine(c.getSides()); square s = new square(); Console.WriteLine(s.getSides()); Graph g; g= new circular(); Console.WriteLine(g.getSides()); g = new square(); Console.WriteLine(g.getSides()); } } public abstract class Graph { public abstract int getSides(); } public class circular : Graph { public override int getSides() { return 1; } } public class square : Graph { public override int getSides() { return 2; } } }

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

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

简答题官方微信公众号

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

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

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