Answer:
The method definition to this question as follows:
Method definition:
void doubleSpace(Scanner input, PrintStream output) //defining method doubleSpace that reads the input file
{
while (input.hasNextLine()) //loop for input values
{
output.println(input.nextLine()); //using print method
output.println(); //using print method
}
}
Step-by-step explanation:
In the above method definition, a method "double-space" is declared, which accepts two parameters, "input and output", in which input is used to take input from the file, with the help of Scanner class, and the output is used to print its value.
- Inside the method, a while loop is declared, that take input from the file, and uses the print method.
- In this method, the output uses the print method to print its value.