File f = new File("input.txt");
Scanner s = new Scanner(f);
String line = s1.nextLine( );
If the input file is in a module, for example module1, in the src folder,
use this statement to create the file:
File f = new File("input.txt");
PrintWriter pw = new PrintWriter("output.txt");
pw.println("Test output.");
pw.close( );
34,21,78,60,53,21,9Ans: the reordered lines are shown below the original scrambled main method.
InputStream s = new URL(urlString).openStream( );
Scanner in = new Scanner(s);
while (in.hasNextLine( )) {
String line = in.nextLine( );
// Process line
}
in.close( );
String chars = " ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
String[ ] codes = {" ", ".-", "-...", "-.-.", "-..",
".", "..-.", "--.", "....", "..", ".---", "-.-",
".-..", "--", "-.", "---", ".--.", "--.-", ".-.",
"...", "-", "..-", "...-", ".--", "-..-", "-.--",
"--..", ".----", "..---", "...--", "....-", ".....",
"-....", "--...", "---..", "----.", "-----"};
Write a method named toMorseCode to perform the translation.37 3.452 "dog" 'c' true.
add size get contains toString clearHere is the test source code for these methods.