Question: in java, please Instructions you will be taking the . java file I have provided and will be implementing the two methods I have setup

in java, please
Instructions you will be taking the .java file I have provided and will be implementing the two methods I have setup
Part One:
Method 1:
public static void convertArrayToFile(char[][] array, String filename){
}
This method should take the two-dimensional array of characters passed in, as well as the name of the file passed in. It should then create a file containing the content of the two-dimensional array of characters. Heres an example to clarify.
Example
Say we have the following array
char array[][]={{h,e,l,l,o},{w,o,r,d}}
String filename =File4.txt
Calling
convertArrayToFile(array, filename) results in the following
File4.txt containing
hello world
*NOTE RUNNING THIS MULTIPLE TIMES MAY RESULT IN EXTRA CONTENT IN FILE3 BE SURE TO CLEAR THE CONTENT OF FILE3 BETWEEN EACH RUN OF METHOD 1
Method 2:
public static char[][] convertFileToArray(String filename){
}
This method should take a String filename as input. It should then read the content of the file and then create a two-dimensional array of characters based on that content. Heres an example to clarify.
Example
Say we have the following File (File2.txt)
File2.txt contains
This is a word
Calling
convertFileToArray(File2.txt) results in the following
{{t,h,i,s},{i,s},{a},{w,o,r,d}}
This the code given
public static void convertArrayToFile(char[][] array, String filename) throws FileNotFoundException{
//Start code here
//End code here
}
public static char[][] convertFileToArray(String filename)throws FileNotFoundException{
//Start code here
return null;
//End code here
}
public static void printArray(char[][] array){
for(int i=0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!