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

public class Test2 { int x = 50; static int y =200 ; public static void method() { System.out.println(x+y); } public static void main(String[] args) { Test2.method(); } } 这段程序可以通过编译。

提问人:网友xuezaixisai 发布时间:2022-01-07
参考答案
  抱歉!暂无答案,正在努力更新中……
如搜索结果不匹配,请 联系老师 获取答案
更多“public class Test2 { int x = 5…”相关的问题
第1题
下面程序代码输出结果是 public class Test{ int x,y; Test(int x,int y ){ this.x = x; this.y = y; } public static void main(String args[]){ Test p1,p2; p1 = new Test(3,3); p2 = new Test(4,4); System.out.println(p1.x+p2.x); } }

A、6

B、3 4

C、8

D、7

点击查看答案
第2题
以下程序段输出的结果是( )。 int i=1; int b,c; int a[]=new int[3]; b=a[i]; c=b+i; System.out.println(c);

A、0

B、1

C、2

D、3

点击查看答案
第3题
(2)请说出A类中 System.out.println 的输出结果。 class B { int x = 100,y = 200; public void setX(int x) { x = x; } public void setY(int y) { this.y = y; } public int getXYSum() { return x+y; } } public class A { public static void main(String args[]) { B b = new B(); b.setX(-100); b.setY(-200); System.out.println("sum="+b.getXYSum()); } }
点击查看答案
第4题
下列程序中( )【代码】是错误的。 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】

点击查看答案
第5题
下列函数定义中,第4条语句是_________。 1 void Test() 2 { 3 int i=100; 4 object s=i; 5 s+=200; 6 }

A、装箱

B、拆箱

C、同时装箱和拆箱

D、都不是

点击查看答案
第6题
下面代码的输出结果是(). x = 12.34 print(type(x))

A、<class'complex'>

B、 <class 'int'>

C、 <class'float'>

D、 <class 'bool'>

点击查看答案
第7题
下面程序运行的结果是: public struct myPoint { public int X, Y; public myPoint(int x, int y) { X = x; Y = y; } public myPoint(int x) : this(x, default(int)) { X = x; } public void show() { Console.Write("x={0},y={1}", X, Y); } } class testA { static void Main() { myPoint p1 = new myPoint(2); myPoint p2 = new myPoint(1, 2); p1 = p2; p1.Y = 10; p1.show(); p2.show(); } }
点击查看答案
第8题
class Test { public static void main(String[] args) { int a = 3; int b = 6; System.out.print(a==b); System.out.print(a<b); system.out.print(a!="b);" system.out.print(a> =b); } }

A、false false true false

B、false false true true

C、false true true false

D、true false false true

点击查看答案
第9题
下列程序运行的结果是 _____。 public class function { public static void main(String[] args) { System.out.println(fun(3)); } static int fun(int n) { if(n>2) { return (fun(n-1)+fun(n-2)); }else { return 2; } } }
点击查看答案
账号:
你好,尊敬的用户
复制账号
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
欢迎分享答案

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

简答题官方微信公众号

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

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

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