//PointXpublicclassfoo{publicstaticvoidmain(String[]args)throwsException{jave.io.PrintWriterout=newjave.io.PrintWriter(newjave.io.OutputStreamWriter(System.out),true);out.println(Hello”);}}WhichstatementatPointXonline1isrequiredtoallowthiscodetocompile?()A.Nostatementisrequired.B.importjave.io.*;C.includejava.io.*;D.importjave.io.PrintWriter;E.includejava.io.PrintWriter;
//PointXpublicclassfoo{publicstaticvoidmain(String[]args)throwsException{jave.io.PrintWriterout=newjave.io.PrintWriter(newjave.io.OutputStreamWriter(System.out),true);out.println(Hello”);}}WhichstatementatPointXonline1isrequiredtoallowthiscodetocompile?()
A.Nostatementisrequired.
B.importjave.io.*;
C.includejava.io.*;
D.importjave.io.PrintWriter;
E.includejava.io.PrintWriter;
相关考题:
publicclassTestOne{publicstaticvoidmain(String[]args)throwsException{Thread.sleep(3000);System.out.println(”sleep”);}}Whatistheresult?() A.Compilationfails.B.Anexceptionisthrownatruntime.C.Thecodeexecutesnormallyandprints“sleep”.D.Thecodeexecutesnormally,butnothingisprinted.
publicclassStarterextendsThread{privateintx=2;publicstaticvoidmain(String[]args)throwsException{newStarter().makeItSo();}publicStarter(){x=5;start();}publicvoidmakeItSo()throwsException{join();x=x-1;System.out.println(x);}publicvoidrun(){x*=2;}}Whatistheoutputifthemain()methodisrum?()A.4B.5C.8D.9E.Compilationfails.F.Anexceptionisthrownatruntime.G.Itisimpossibletodetermineforcertain.
//pointXpublicclassfoo{publicstaticvoidmain(String[]args)throwsException{java.io.printWriterout=newjava.io.PrintWriter{newjava.io.outputStreamWriter(System.out),true;out.printIn(Hello”);}}}WhichstatementatPointXonline1allowsthiscodetocompileandrun?()A.Importjava.io.*;B.Includejava.io.*;C.Importjava.io.PrintWriter;D.Includejava.io.PrintWriter;E.Nostatementisneeded.
//pointXpublicclassfoo(publicstaticvoidmain(String[]args)throwsException{printWriterout=newPrintWriter(newjava.io.outputStreamWriter(System.out),true;out.printIn(Hello”);})WhichstatementatPointXonline1allowsthiscodetocompileandrun?()A.Importjava.io.PrintWriter;B.Includejava.io.PrintWriter;C.Importjava.io.OutputStreamWriter;D.Includejava.io.OutputStreamWriter;E.Nostatementisneeded.
以下哪个是有效的Java程序入口函数?A.public static void main(String[] args);B.public static void main();C.public static int main(String[] args);D.public static void main(int argc, String[] args)
以下哪个main方法是正确的?A.public static void main(string[] args)B.public static void Main(String[] args)C.public static void main(String[] args)D.public static main(String[] args)E.public void main(String[] args)
main()方法的正确定义方式是()。A.public static void main (String [ ] args ) { new NameSurfer().start (args ) ; }B.public static main (String [ ] args ) { new NameSurfer().start (args ) ; }C.public void main (String [ ] args ) { new NameSurfer().start (args ) ; }D.public static void main (String [ ] args ) { NameSurfer().start (args ) ; }
以下哪个是有效的Java程序入口函数?A.public static void main(String[] args);B.public static void main();C.public static int main(String[] args);D.public static void main(int argc, String[] args)E.main()
19、以下哪个是有效的Java程序入口函数?A.public static void main(String[] args);B.public static void main();C.public static int main(String[] args);D.public static void main(int argc, String[] args)