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

Static Nested Class 和 Inner Class的不同,说得越多越好

提问人:网友zcxtdn 发布时间:2022-01-06
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
更多“Static Nested Class 和 Inner Cl…”相关的问题
第1题
下列代码标注的(A,B,C,D)中哪一个是错误的? class OutClass { int m = 1; static float x; class InnerClass { int m =12; static float n =20.89f; InnerClass(){ } void f() { m = 100; } } void cry() { InnerClass tom = new InnerClass(); } }

A、static float x;

B、int m =12;

C、static float n =20.89f;

D、InnerClass tom = new InnerClass();

点击查看答案
第2题
有以下代码:public class Test { String s; static class Inner { void testMethod() { s = "Hello world."; } } public static void main(String[] argv) { Inner i = new Inner(); i.testMethod(); System.out.println(s); } } 以下哪句是正确的?

A、编译通过,打印出Hello world.

B、无法编译,因为Test类里的String s不是static的

C、无法编译,因为Inner不能像这样在main中使用

D、编译通过,但是运行时刻出错,因为s没有被初始化

点击查看答案
第3题
给定以下代码,以下哪句是正确的? public class Test { String s; static class Inner { void testMethod() { s = "Hello world."; } } public static void main(String[] argv) { Inner i = new Inner(); i.testMethod(); System.out.println(s); } }

A、编译通过,但是运行时刻出错,因为s没有被初始化

B、无法编译,因为Test类里的String s不是static的

C、编译通过,打印出Hello world.

D、无法编译,因为Inner不能像这样在main中使用

点击查看答案
第4题
设有如下代码: class Base{} public class MyCast extends Base{ static boolean b1=false; static int i = -1; static double d = 10.1; public static void main(String argv[]){ MyCast m = new MyCast(); Base b = new Base(); //Here } } 则在 //Here处插入哪个代码将不出现编译和运行错误。

A、b=m;

B、m=b;

C、d =i;

D、b1 =i;

点击查看答案
第5题
public class OneOuterClass { private int i = 10; private int j = 20; private class OneInnerClass{ private int i= 30; public void print(){ System.out.println("Sum:i+j="+(i+j) ); } } public static void main(String[] args) { newZjOuterClass().new ZjInnerClass().print(); } } 输出结果是:
点击查看答案
第6题
在一个Java程序中有一个Out类,Out类中有一个内部类Inner类,该Java文件编译后生成的.class文件中包括()。
A.Out.class

B.Inner.class

C.Out.Inner.class

D.Out$Inner.class

点击查看答案
第7题
【多选题】(6-10)有如下代码,请为指定位置选择正确代码。( ) class Outer{ class Inner{ void show() { System.out.println("inner"); } } public void aOuterMethod() { // ① } public static void main(String[] args) { Outer out=new Outer(); // ② Outer.Inner inn=out.new Inner(); // inn.show(); } }

A、① new Inner();

B、② Inner inn=new out.Inner();

C、② Inner = new Inner()

D、② Inner inn=out.new Inner();

E、② Outer.Inner inn=out.new Inner();

F、① this.show();

点击查看答案
第8题
如果有下面的程序: class A { int x ; int y ; public: A(int a,int b) { x = a ; y = b ; } A(A &a) { x = a.x *1000 ; y = a.y *1000 ; } void display() { cout << x << "," << y ; } } ; A a1(2,5); A a2(a1) ; a2.display() ; 则该程序的显示输出是()。

A、2000,5000

B、5000,2000

C、2,5

D、5,2

点击查看答案
第9题
Overloaded的方法是否可以改变返回值的类型?
点击查看答案
第10题
分析以下代码,完成填空

string strTmp = "abcdefg某某某";

int i= System.Text.Encoding.Default.GetBytes(strTmp).Length;

int j= strTmp.Length;

以上代码执行完后,i= j=

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

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

简答题官方微信公众号

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

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

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