// Tyler Mi // Code highlighting problems that we can do recursively import java.util.*; import java.io.*; public class Recursion { public static void main(String[] args) throws FileNotFoundException { writeStars(3); Scanner fileScan = new Scanner(new File("words.txt")); reverseFile(fileScan); } // // Prints out n stars on a line, then prints a linebreak // public static void writeStars(int n) { // while (n > 0) { // System.out.print("*"); // n--; // } // System.out.println(); // n == 0 // } // Prints out n stars on a line, then prints a linebreak public static void writeStars(int n) { if (n == 0) { System.out.println(); } else { System.out.print("*"); writeStars(n - 1); } } // Prints the contents of the given Scanner, line by line, in reverse public static void reverseFile(Scanner input) { if (input.hasNextLine()) { String line = input.nextLine(); reverseFile(input); System.out.println(line); } } }