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

下面Java程序的运行结果:()public class NULL { public static void haha(){ System.out.prin

下面Java程序的运行结果:()public class NULL { public static void haha(){ System.out.prin

tln("haha"); } public static void main(String[] args) { ((NULL)null).haha(); } }

A.无法正常运行

B.NULL

C.null

D.haha

提问人:网友zytt123 发布时间:2022-01-07
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
更多“下面Java程序的运行结果:()public class N…”相关的问题
第1题
给定以下代码,程序的运行结果是 ()public class Test { public static void main(String[] args) { String a = "Programming"; String b = new String("Programming"); String c = "Program" + "ming"; System.out.println(a == b); System.out.println(a == c); System.out.println(a.equals(b)); System.out.println(a.equals(c)); } }
点击查看答案
第2题

import java.io.*; public class ABC { public static void main(String args[]) throws Exception { int i, n = 3, a = 0, b = 0, temp = 0; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); a = b = Integer.parseInt(br.readLine()); for (i = 0; i <= n; i++) { temp="Integer.parseInt(br.readLine());" if (temp> a) a = temp; if (temp < b) b = temp; } System.out.println("a=" + a + "\nb=" + b); } } 运行代码,输入3↓ 24 ↓ 96↓ 25↓后的输出结果是: 备选答案:A.a=3↓b=96 B. a=96↓b=3 C.a=25↓b=3 D.a=24↓b=25

点击查看答案
第3题
阅读下段代码 import java.io.*; public class Example{ public static void main(String[] args) throws Exception { FileInputStream fis = new FileInputStream("file.txt"); FileOutputStream fos = new FileOutputStream("copy_file.txt"); int ch = 0; while((ch =fis.read())!=-1){ fos.write(ch); } fos._______; fis.close(); } } 请说出下划线上,填写的方法名称( )

A、read()

B、available()

C、close()

D、write()

点击查看答案
第4题
下列程序运行后的结果可能是________。 import java. io. *; public class Test { public static void main (String [] args) { File file =new File ( "hello . txt" ) ; if (file. exists () ) { file.delete () ; } else { try { file . createNewFile ( ) ; } catch (Exception e ) { e .printStackTrace ( ) ; } } } }

A、如果文件不存在 ,则程序退出

B、如果文件已经存在 , 则程序退出

C、如果文件已经存在,则保留该文件

D、如果文件不存在 , 则创建该文件

点击查看答案
第5题
有以下C#程序:using System; namespace aaa { class Program { static void Main() { String str; str = Console.ReadLine(); bool a = str.Equals("a"); Console.WriteLine(a.ToString()); int b = str.Length; Console.WriteLine(b.ToString()); } } } 在程序运行时输入为: AAAAA(3个空格加5个A)则程序输出为( )。

A、0 8

B、False 8

C、-1 8

D、False 5

点击查看答案
第6题
(字节输出流写文件)阅读下面程序:import java.io.*; public class ByteStrearnTest{ public static void main(String[] args){ int[] myArray={11,20,30,40}; try{ DataOutputStream dos=new DataOutputStream(new____("ints.dat")); for(int i=0;i<myarray.length;i+=) dos.writeint(myarray[i]); dos.close(); system.out.println("have written binary file ints.dat"); }catch(ioexception ioe){ system.out.println("ioexception"); }> A、FileOutputStream

B、ByteArrayOutputStream

C、BufferedOutputStream

D、FileWriter

点击查看答案
第7题
编译并运行下述程序段的结果是 public class Test{ public static void main(String argv[]){ int[] count = new int[4]; System.out.println(count[4]); } }

A、编译错误

B、运行错误

C、输出0

D、输出null

点击查看答案
第8题
5、编写一个java application程序,其中类声明为public class StringDemo,那么该程序应该以什么文件名来保存?( ) A、StringDemo.java B、StringDemo.class C、Strindemo.java D、StringDemo.txt
点击查看答案
第9题
阅读下面程序,判断它的输出结果?PublicclassHello{publicstaticvoidmain(Stringargs[]){inti=0;Stringstr[]={"11","22"};while(i<3){System.out.print(str[i]);i++;}}}

A、1122

B、1122java.lang.ArrayIndexOutOfBoundsException:2atHello.main...

C、java.lang.ArrayIndexOutOfBoundsException:2atHello.main...

D、1122Error!

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

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

简答题官方微信公众号

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

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

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