下面程序创建了一个线程并运行,请填空,使程序完整。
public class ThreadTest {
public static void main (String[] args) {
Hello h=Hew Hello ();
【 】
t.start ();
}
}
class Hello implements Runnable {
int i;
public void run () {
while(true) {
System.out.println("Hello" +i++);
if(i==5) break;
}
}
}
A.public static void main()
B.public static void main(String[] args)
C.public static int main(String[] args)
D.public void main(String[] args)
下列哪个是对main( )主方法的正确表示?
A.public void static main(String args[ ]){ ... }
B.void public static main(String args[ ]){ ... }
C.static public void main(String args[ ]){ ... }
D.以上都不正确
main方法是Java Application程序执行的入口点,关于main方法头以下( )是合法的。
A.pubUc statk void main()
B.public static void main (String[]args)
C.public static int main (String[]arg)
D.public void main (String arg[])
main方法是JavaApplication程序执行的入口点。关于main方法的方法头,下列合法的是( )。
A.public static void main()
B. public static void main(String[])args)
C. public static iht main(String[]arg)
D.public void main(String arg[])
北京宇信易诚科技有限公司招聘JAVA笔试真题及答案选择题 1:鉴于Java的特点,它最适合的计算环境是bA.并行计算环境 B.分布式计算环境 C.高强度计算环境 D.开放式计算环境 2:Which method you define as the starting point of new thread in a class from which new the thread can be excution? bA.public void start() B.public void run() C.public void runnable() D.public static void main(String args) 3:Which statement about listener is true? A 什么是ListenerA.Most component allow multiple listeners to be added. B.If multiple listener be add to a single component, the event only affected one listener. C.Component don?t allow multiple listeners to be add. D.none 4:软件生命周期的瀑布模型把软件项目分为3个阶段、8个子阶段,以下哪一个是正常的开发顺序? aA.计划阶段、开发阶段、运行阶段 B.设计阶段、开发阶段、编码阶段 C.设计阶段、编码阶段、维护阶段 D.计划阶段、编码阶段、测试阶段 5: b 1. Whatwillbeprintedwhenyouexecutethefollowingcode? 2. 3. classX 4. 5. Yb=newY(); 6. X() 7. 8. System.out.print(X); 9. 10. 11. 12. classY 13. 14. Y() 15. 16. System.out.print(Y); 17. 18. 19. 20. publicclassZextendsX 21. 22. Yy=newY(); 23. Z() 24. 25. System.out.print(Z); 26. 27. publicstaticvoidmain(Stringargs) 28. 29. newZ(); 30. 31. 32. 33. Choices:What will be printed when you execute the following code? class X Y b = new Y(); X() System.out.print(X); class Y Y() System.out.print(Y); public class Z extends X Y y = new Y(); Z() System.out.print(Z); public static void main(String args) new Z(); Choices:A.Z B.YZ C.XYZ D.YXYZ 6: c1. Givethefollowingmethod: 2. publicvoidmethod() 3. Stringa,b; 4. a=newString(“helloworld”); 5. b=newString(“gameover”); 6. System.out.println(a+b+”ok”); 7. a=null; 8. a=b; 9. System.out.println(a); 10. 11. Intheabsenceofcompileroptimization,whichistheearliestpointtheobjectareferedisdefinitelyelibiletobegarbagecollection.Give the following method: public void method( ) String a,b; a=new String(“hello world”); b=new String(“game over”); System.out.println(a+b+”ok”); a=null; a=b; System.out.println(a); In the absence of compiler optimization, which is the earliest point the object a refered is definitely elibile to be garbage collection.A.before line 5 B.before line 6 C.before line 7 D.before line 9 7: c1. Whichisthemostappropriatecodesnippetthatcanbeinsertedatline18inthefollowingcode? 2. 3. (Assumethatthecodeiscompiledandrunwithassertionsenabled) 4. 5. 1.importjava.util.*; 6. 7. 2. 8. 9. 3.publicclassAssertTest 10. 11. 4. 12. 13. 5.privateHashMapcctld; 14. 15. 6. 16. 17. 7.publicAssertTest() 18. 19. 8. 20. 21. 9.cctld=newHashMap(); 22. 23. 10.cctld.put(in,India); 24. 25. 11.cctld.put(uk,UnitedKingdom); 26. 27. 12.cctld.put(au,Australia); 28. 29. 13./morecode. 30. 31. 14. 32. 33. 15./othermethods. 34. 35. 16.publicStringgetCountry(String
main方法是Java Application程序执行的入口点,关于main方法头以下( )是合法的。
A.public static void main( )
B.public static void main (String[ ]args)
C.public static int main (String[ ]arg)
D.public void main(String arg[])
下列( )是对main ()主方法的正确表示。
A.public void static main (String args []) {…}
B.void public static main (String args []) {…}
C.static public void main (String args []) {…}
D.以上都不正确
A. public static void main();
B. public static void main( String args );
C. public static void main( String args[] );
D. public static void main( Graphics g );
E. public static boolean main( String a[] );
以下是JAVA中正确的入口方法是? ()
class MyThread extends Thread { public void run() { System.out.println(“AAA”); } public void run(Runnable r) { System.out.println(“BBB”); } public static void main(String[] args) { new Thread(new MyThread()).start(); } } What is the result?()