网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
在J2EE中,如果去编译并运行下面的代码,在这里假定在当前目录下没有Hello.txt文件:import&e

在J2EE中,如果去编译并运行下面的代码,在这里假定在当前目录下没有Hello.txt文件:

importjava.io.*;

publicclassMine{

publicstaticvoidmain(Stringargv[]){

Minem=newMine();

System.out.println(m.amethod());}

publicintamethod(){try{

FileInputStreamdis=newFileInputStream("Hello.txt");}

catch(FileNotFoundExceptionfne){

System.out.println("Nosuchfilefound");

return-1;}

catch(IOExceptionioe){}finally{

System.out.println("Doingfinally");}

return0;}}

结果会输出()。


参考答案

更多 “ 在J2EE中,如果去编译并运行下面的代码,在这里假定在当前目录下没有Hello.txt文件:importHello.txt);}catch(FileNotFoundExceptionfne){System.out.println(Nosuchfilefound);return-1;}catch(IOExceptionioe){}finally{System.out.println(Doingfinally);}return0;}}结果会输出()。 ” 相关考题
考题 在J2EE中,假如在当前目录下不存在employee.txt文件。在当前目录下的一个类文件的main函数只包含如下代码:try{//1PrintWriterout=newPrintWriter(newFileOutputStream(employee.txt”));//2Stringname=jb-aptech”;//3doublesalary=75000;//4out.print(name);//5out.print(‘‘);//6out.println(salary);//7}//8catch(Exceptione)//9System.out.println(文件没有发现!);//10在DOS控制台上编译并且运行该类文件。下面的描述正确的是()。A.使用java命令运行该类文件,将在控制台上打印:文件没有发现!B.运行结束后打开employee.txt,会发现该文件什么也没有C.运行结束后打开employee.txt,会发现文件中有这样的文本:“jb-aptech75000”D.在第7行后加上代码:out.close(),编译并运行该类文件后,打开employee.txt,才会发现文件中有这样的文本:“jb-aptech75000.0”E.把第2行代码改为:PrintWriterout=newPrintWriter(newFileOutputStream(“employee.txt”),true);编译并运行该类文件后,打开employee.txt,才会发现文件中有这样的文本:“jb-aptech75000.0”

考题 在J2ee中,在、mySample.java中包含代码:System.out.println((InetAddress.getByName(aaaa)).getHostAddress()),但在网络上没有aaaa这台主机。那么该行代码会()。 A.编译运行后什么也不显示B.编译运行后显示“aaaa”字符文本C.编译不能通过D.编译运行后会跑出java.net.UnknownHostException异常

考题 在j2ee中,在mysample.java中包含代码:system.out.println(InetAddress.getByName(“aaaa”)).getHostAddress()),但在网络上没有aaaa这台主机。那么该行代码会() A.编译运行后什么都不显示B.编译运行后显示“aaaa”字符文本C.编译不能通过D.编译运行后会抛出java.net.UnlnownHostExceptioon异常

考题 在J2EE中,在mySample.java中包含代码:System.out.println((InetAddress.getByName(“aaa”)).getHostAddress()),但在网络上没有aaaa这台主机。那么该行代码会()。 A.编译运行后什么也不显示B.编译运行后显示“aaaa”字符文本C.编译不能够通过D.编译运行后会抛出java.net.UnknownHostException异常

考题 在J2EE中,加入在当前目录下不存在employee.txt文件。在当前目录下的一个类文件的main函数只包含如下代码:try{//1PrintWriterout=newPrintWriter(newFileOutputStream(employee.txt”));//2Stringname=”jb-aptech”;//3doublesalary=75000;//4out.print(name);//5out.print(??);//6out,print(salary);//7}//8catch(Exceptione){//9System.out.println(文件没有被发现!”);//10}//11在DOS控制台上编译并运行该类文件。下面描述正确的是()。

考题 如果在编译Java程序时,编译结果报告说找不到要编译的代码,通常的错误不是如下的______项?A.没有import相应的包B.源文件不在当前目录下C.没有加.java后缀D.文件名拼写错误

考题 编译并运行下面的Java代码段输出结果是()。A.代码无法编译,因为switch语句没有一个合法的表达式B.adefaultC.aD.default

考题 编译运行下面的程序,结果是什么? public class A { public static void main(String[] args) { B b = new B(); b.test(); } void test() { System.out.print("A"); } } class B extends A { void test() { super.test(); System.out.print("B"); } }A.产生编译错误B.代码可以编译运行,并输出结果ABC.代码可以编译运行,但没有输出D.编译没有错误,但会产生运行时异常

考题 【单选题】编译运行下面的程序,结果是()。 class Main{ public static void main(String args[]){ ClassB b=new ClassB(); } public Main(){ System.out.print("A"); } } class ClassB extends Main{ public ClassB(){ super(); System.out.print("B"); } }A.产生编译错误B.代码可以编译运行,并输出结果:ABC.代码可以编译运行,但没有输出D.代码可以编译运行,并输出结果:BA