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

题目内容 (请给出正确答案)
单选题
Which statements are true, given the code new FileOutputStream("data", true) for creating an object of class FileOutputStream?()
A

FileOutputStream has no constructors matching the given arguments.

B

An IOExeception will be thrown if a file named data already exists.

C

An IOExeception will be thrown if a file named data does not already exist.

D

If a file named data exists, its contents will be reset and overwritten.

E

If a file named data exists, output will be appended to its current contents.


参考答案

参考解析
解析: 暂无解析
更多 “单选题Which statements are true, given the code new FileOutputStream("data", true) for creating an object of class FileOutputStream?()A FileOutputStream has no constructors matching the given arguments.B An IOExeception will be thrown if a file named data already exists.C An IOExeception will be thrown if a file named data does not already exist.D If a file named data exists, its contents will be reset and overwritten.E If a file named data exists, output will be appended to its current contents.” 相关考题
考题 单选题It is desirable that a certain method within a certain class can only be accessed by classes that are defined within the same package as the class of the method. How can such restrictions be enforced?()A Mark the method with the keyword public.B Mark the method with the keyword protected.C Mark the method with the keyword private.D Mark the method with the keyword package.E Do not mark the method with any accessibility modifiers.

考题 单选题1. public class Target {  2. private int i = 0;  3. public int addOne() {  4. return ++i;  5. }  6. }  And:  1. public class Client {  2. public static void main(String[] args) {  3. System.out.println(new Target().addOne());  4. }  5. }  Which change can you make to Target without affecting Client?()A  Line 4 of class Target can be changed to return i++;B  Line 2 of class Target can be changed to private int i = 1;C  Line 3 of class Target can be changed to private int addOne() {D  Line 2 of class Target can be changed to private Integer i = 0;

考题 多选题Which declarations of identifiers are legal?()A$personsBTwoUsersC*pointDthisE_endline

考题 单选题public class X {   public static void main (String[]args)   {   string s = new string (“Hello”);   modify(s);   System.out.printIn(s);   }   public static void modify (String s)  {   s += “world!”;      }   }      What is the result?()A  The program runs and prints “Hello”B  An error causes compilation to fail.C  The program runs and prints “Hello world!”D  The program runs but aborts with an exception.

考题 多选题public class Car {  private int wheelCount;  private String vin;  public Car(String vin) {  this.vin = vin;  this.wheelCount = 4;  }  public String drive() {  return “zoom-zoom”;  }  public String getInfo() {  return “VIN: “+ vin + “wheels: “+ wheelCount;  }  }  And:  public class MeGo extends Car {  public MeGo(String vin) {  this.wheelCount = 3;  }  }  What two must the programmer do to correct the compilation errors?()Ainsert a call to this() in the Car constructorBinsert a call to this() in the MeGo constructorCinsert a call to super() in the MeGo constructorDinsert a call to super(vin) in the MeGo constructorEchange the wheelCount variable in Car to protectedFchange line 3 in the MeGo class to super.wheelCount = 3;

考题 单选题Which statements concerning the switch construct are true?()A All switch statements must have a default label.B There must be exactly one label for each code segment in a switch statement.C The keyword continue can never occur within the body of a switch statement.D No case label may follow a default label within a single switch statement.E A character literal can be used as a value for a case label.