Java 考试题2.doc 9页

  • 29
  • 0
  • 0
  • 约7.43千字
  • 2017-12-19 发布
文档工具:
    1. 1、本文档共9页,可阅读全部内容。
    2. 2、本文档内容版权归属内容提供方,所产生的收益全部归内容提供方所有。如果您对本文有版权争议,可选择认领,认领后既往收益都归您。
    3. 3、本文档由用户上传,本站不保证质量和数量令人满意,可能有诸多瑕疵,付费之前,请仔细先通过免费阅读内容等途径辨别内容交易风险。如存在严重挂羊头卖狗肉之情形,可联系本站下载客服投诉处理。
    4. 文档侵权举报电话:19940600175。
    Java 考试题2

    Part 1: Single-choice questions(20 points) 1、Which keyword is used to allow interaction with the lock flag? A. native B. static C. synchronized D. abstract 2、Given the following fragment of code: Double d1 = new Double(1.0); Double d2 = new Double(1.0); Float f = new Float(1.0F); Which results of the following expressions are true? A. d1 == d2 B. d1.equals(d2) C. d1 = f D. f.equals(d1) 3. What would be the result of attempting to compile and run the following piece of code? public class Test { public static void main(String args[]){ int x; System.out.println("Value is " + x); } } A. The output "Value is 0" is printed. B. An object of type NullPointerException is thrown. C. An "illegal array declaration syntax" compiler error occurs. D. A "possible reference before assignment" compiler error occurs. 4. A design pattern is typically used to A. allow the use of object-orientated concepts in a language that is not object-oriented B. describe a practical solution to a common design problem C. ensure that code executes at optimal speed during runtime D. reduce the number of classes in the design of a program 5.import java.io.*; public class Ppvg{ public static void main(String argv[]){ Ppvg p = new Ppvg(); p.fliton(); } public int fliton(){ try{ FileInputStream din = new FileInputStream("Ppvg.java"); din.read(); }catch(IOException ioe){ System.out.println("flytwick"); return 99; }finally{ System.out.println("fliton"); } return -1; } } Assuming the file Ppvg.java is available to be read which of the following statements are true if you try to compile and run the program? A.The program will run and output only "flytwick" B. The program will run and output only "fliton" C. The program will run and output both "fliton" and "flytwick" D. An error will occur at compile time because the method fliton attempts to return two values 6. In Java, the default layout manager for a JPanel component is A. GridLayout B. BorderL

    文档评论(0)

    • 内容提供方:xcs88858
    • 审核时间:2017-12-19
    • 审核编号:5341311324001134

    相似文档