Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am not allowed to import any additional packages or classes and I also have to

ID: 3847536 • Letter: I

Question

I am not allowed to import any additional packages or classes and I also have to use the variable "ostream" instead of Files.newOutputStream(Paths.get("...")); to write to the file. I just need help editing this existing code so that it works.

Write a Java variable arity method writeFile() that takes any number of integer parameters and writes the values of the parameters to a file in their original order. In Coderunner, the file is hidden from you and is instead made available to you via an Outputstream object reference by the ostream instance variable in the class in which your method will be placed. Use this object instead of Files newoutputstream(Paths. get("...")), to write to the file For example Result Test write File (1, 2, 3, 4); 1 2 3 4 readFile Answer: 1 public void write File nt numbers Dataoutput stream input null try input new Dataoutputstream(ostream); for (in i 0: i numbers size i++){ input write (numbers get(i)); input close(); catch (IOException e){ 10 System.out.println(e); 11 12 13

Explanation / Answer

Let's use the below example. In this example, we are not using Files.newOutputStream(Paths.get("...")); we are just writing this using object itself.