单选题Which statements are true, given the code new FileOutputStream("data", true) for creating an object of class FileOutputStream?()AFileOutputStream has no constructors matching the given arguments.BAn IOExeception will be thrown if a file named data already exists.CAn IOExeception will be thrown if a file named data does not already exist.DIf a file named data exists, its contents will be reset and overwritten.EIf 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.


参考解析

解析: 暂无解析

相关考题:

Given:Which code, inserted at line 4, guarantees that this program will output [1, 2]()? A.Set set = new TreeSet();B.Set set = new HashSet();C.Set set = new SortedSet();D.List set = new SortedList();E.Set set = new LinkedHashSet();

Given that the current directory is empty, and that the user has read and write privileges to the current, and the following:Which statement is true?() A.Compilation fails.B.Nothing is added to the file system.C.Only a new file is created on the file system.D.Only a new directory is created on the file system.E.Both a new file and a new directory are created on the file system.

Click the Exhibit button. Given:Which two statements are true if a NullPointerException is thrown on line 3 of class C? () A.The application will crash.B.The code on line 29 will be executed.C.The code on line 5 of class A will execute.D.The code on line 5 of class B will execute.E.The exception will be propagated back to line 27.

Given:Which code fragment, inserted at line 23, allows the code to compile?() A.df = new DateFormat();B.df = Date.getFormat();C.df = date.getFormat();D.df = DateFormat.getFormat();E.df = DateFormat.getInstance();

Given:Which code, inserted at line 15, allows the class Sprite to compile?() A.Foo { public int bar() { return 1; }B.new Foo { public int bar() { return 1; }C.new Foo() { public int bar() { return 1; }D.new class Foo { public int bar() { return 1; }

Given:Which code, inserted at line 16, correctly retrieves a local instance of a Point object?() A.Point p = Line.getPoint();B.Line.Point p = Line.getPoint();C.Point p = (new Line()).getPoint();D.Line.Point p = (new Line()).getPoint();

Which two statements are true with regard to policy ordering? ()(Choose two.) A. The last policy is the default policy, which allows all traffic.B. The order of policies is not important.C. New policies are placed at the end of the policy list.D. The insert command can be used to change the order.

Given:  Integer i = new Integer (42);  Long l = new Long (42);  Double d = new Double (42.0);   Which two expression evaluate to true?()A、 (i = = l)B、 (i = = d)C、 (d = = l)D、 (i.equals(d))E、 (i.equals(i))F、 (i.equals(42))

Which statements about Java code security are true?() A、 The bytecode verifier loads all classes needed for the execution of a program.B、 Executing code is performed by the runtime interpreter.C、 At runtime the bytecodes are loaded, checked and run in an interpreter.D、 The class loader adds security by separating the namespaces for the classes of the local file system from those imported from network sources.

If a vessel subject to PSC inspection, PSC Officer shall give the inspection to the Captain, the given timeframe for rectification of each deficiency is commonly given in a coded form which called “action code”, which code listed below is used for indication of detention of the vessel?()A、10B、30C、17D、16

Given this method in a class:  public String toString() {  StringBuffer buffer = new StringBuffer();  buffer.append(‟‟);  buffer.append(this.name);  buffer.append(‟‟);  return buffer.toString();  }  Which is true?() A、 This code is NOT thread-safe.B、 The programmer can replace StringBuffer with StringBuilder with no other changes.C、 This code will perform well and converting the code to use StringBuilder will not enhance the performance.D、 This code will perform poorly. For better performance, the code should be rewritten: return ““+ this.name + “”;

Given the following code fragment:     public void create() {     Vector myVect;     myVect = new Vector();      }  Which of the following statements are true?() A、 The declaration on line 2 does not allocate memory space for the variable myVect.B、 The declaration on line 2 allocates memory space for a reference to a Vector object.C、 The statement on line 2 creates an object of class Vector.D、 The statement on line 3 creates an object of class Vector.E、 The statement on line 3 allocates memory space for an object of class Vector.

The file “file.txt” exists on the file system and contsins ASCII text.  Given:   try {   File f = new File(“file.txt”);    OutputStream out = new FileOutputStream(f, true);   }    catch (IOException) {}   What is the result?()A、 The code does not compile.B、 The code runs and no change is made to the file.C、 The code runs and sets the length of the file to 0.D、 An exception is thrown because the file is not closed.E、 The code runs and deletes the file from the file system.

单选题Which of the following statements is TRUE of telecommuting?AIt is up to the employees to accept it or not.BIt is getting popular in different companies.CIt is a new untested way of working.DIt is a traditional work arrangement.

单选题If a vessel subject to PSC inspection, PSC Officer shall give the inspection to the Captain, the given timeframe for rectification of each deficiency is commonly given in a coded form which called “action code”, which code listed below is used for indication of detention of the vessel?()A10B30C17D16

多选题Click the Exhibit button.   Given: Which two statements are true if a NullPointerException is thrown on line 3 of class C?()AThe application will crash.BThe code on line 29 will be executed.CThe code on line 5 of class A will execute.DThe exception will be propagated back to line 27.EThe code on line 5 of class B will execute.

单选题Given: Which statement is true?()A  The cardID and limit variables break polymorphism.B  The code demonstrates polymorphism.C  The ownerName variable breaks encapsulation.D  The setCardInformation method breaks encapsulation.E  The class is fully encapsulated.

单选题The file “file.txt” exists on the file system and contsins ASCII text.  Given:   try {   File f = new File(“file.txt”);    OutputStream out = new FileOutputStream(f, true);   }    catch (IOException) {}   What is the result?()A The code does not compile.B The code runs and no change is made to the file.C The code runs and sets the length of the file to 0.D An exception is thrown because the file is not closed.E The code runs and deletes the file from the file system.

单选题According to the passage, which of the following statements is NOT TRUE?AThe national monument in Hawaii was created by President Bush.BThere is no objection to President Obama's decision.CPresident Obama made this decision on his own.DThe establishment of the new monument will lead to new iobs.

单选题Which statements are true, given the code new FileOutputStream("data", true) for creating an object of class FileOutputStream?()AFileOutputStream has no constructors matching the given arguments.BAn IOExeception will be thrown if a file named data already exists.CAn IOExeception will be thrown if a file named data does not already exist.DIf a file named data exists, its contents will be reset and overwritten.EIf a file named data exists, output will be appended to its current contents.

多选题Given the following code, which code fragments, when inserted at the indicated location, will succeed in making the program display a button spanning the whole window area?()   import java.awt.*;   public class Q1e65 {   public static void main(String args[]) {   Window win = new Frame();   Button but = new Button("button");   // insert code fragment here  win.setSize(200, 200);   win.setVisible(true);   }   }Awin.setLayout(new BorderLayout()); win.add(but);Bwin.setLayout(new GridLayout(1, 1)); win.add(but);Cwin.setLayout(new BorderLayout()); win.add(but, BorderLayout.CENTER);Dwin.add(but);Ewin.setLayout(new FlowLayout()); win.add(but);

单选题Given: Which code, inserted at line 15, creates an instance of the Point class defined in Line?()A Point p = new Point();B Line.Point p = new Line.Point();C The Point class cannot be instatiated at line 15.D Line l = new Line() ; l.Point p = new l.Point();

单选题Given this method in a class:  public String toString() {  StringBuffer buffer = new StringBuffer();  buffer.append(‟‟);  return buffer.toString();  }  Which is true?()A This code is NOT thread-safe.B The programmer can replace StringBuffer with StringBuilder with no other changes.C This code will perform well and converting the code to use StringBuilder will not enhance the performance.D This code will perform poorly. For better performance, the code should be rewritten: return ““+ this.name + “”;

多选题Given:  Integer i = new Integer (42);  Long l = new Long (42);  Double d = new Double (42.0);   Which two expression evaluate to true?()A(i = = l)B(i = = d)C(d = = l)D(i.equals(d))E(i.equals(i))F(i.equals(42))

多选题Given the following code fragment:     public void create() {     Vector myVect;     myVect = new Vector();      }  Which of the following statements are true?()AThe declaration on line 2 does not allocate memory space for the variable myVect.BThe declaration on line 2 allocates memory space for a reference to a Vector object.CThe statement on line 2 creates an object of class Vector.DThe statement on line 3 creates an object of class Vector.EThe statement on line 3 allocates memory space for an object of class Vector.

单选题Given that the current directory is empty, and that the user has read and write privileges to the current directory, and the following: Which statement is true?()A Compilation fails.B Nothing is added to the file system.C Only a new file is created on the file system.D Only a new directory is created on the file system.E Both a new file and a new directory are created on the file system.

单选题It is usual to identify the fluids in pipes by bands of paint at intervals, and the engineer should familiarize himself with the code in use.According to the above sentence, which of the following statements is true?()APeople can know the types of fluids in pipes by feeling with handsBThere are series of rings painted in the pipes to show various fluidsCEngineers should wear cards standing for ranksDEngineer knows his own code very well

单选题Which of the following statements is NOT TRUE?AManhattan is the centre of New York City.BNew York City is made up of five parts.CNew York looks like a long finger from the air.DManhattan is an island.