• 2022-07-25
    新建一个流对象,下列( )选项的代码是错误的。
    A: new BufferedWriter(new FileWriter("a.txt"));
    B: new BufferedReader(new FileInputStream("a.dat"));
    C: new DataOutputStream(new FileOutputStream("a.txt"));
    D: new ObjectInputStream(new FileInputStream("a.dat"));
  • B

    举一反三

    内容

    • 0

      下列代码中给出正确的在方法体内抛出异常的是( )。 A: new throw Exception(" "); B: throw new Exception(" "); C: throws IOException(); D: throws IOException;

    • 1

      下列定义字符串数组的语法正确的是( )? A: String[] list = new String[]{"red", "yellow", "green"}; B: String list = new String{"red", "yellow", "green"}; C: String list = {"red", "yellow", "green"}; D: String[] list = {"red", "yellow", "green"};

    • 2

      下列定义字体对象ft的语句中,正确的是___________。 A: Dim ft As New Font("隶书", 18) B: Dim ft As Font = New Font("隶书", 18) C: Dim ft As Font = ("隶书", 18) D: Dim ft("隶书", 18) As Font E: Dim ft = Font ("隶书", 18)

    • 3

      下列值不为true的表达式有(  )。 A: "john" = = "john"  B:  "john".equals("john") C: "john" = "john" D:  "john".equals(new String("john")) 

    • 4

      下列关于Java数组的代码片段,错误的是( )。 A: int[] a=new int[20]; B: String[] names = new String[3]; C: String[] names = {"Bob", "Achebe", null}; D: int[5] ages = new int[];