Define a public static method named f2s that takes a single String argument, the name of a file. The method returns a (concievably very large!) String that is an exact copy of the contents of the file. If the file cannot be opened the method returns null.

Respuesta :

Answer:

public static String f2s(String s) throws IOException {

File f = new File(s);

Scanner input = new Scanner(f);

String ss = "";

while (input.hasNext()) {

ss += input.nextLine();

}

return ss;

}