Source of Question3.java


  1: public class Question3
  2: {
  3:     public static void main(String[] args)
  4:     {
  5:          displaySharps(3);
  6:     }
  7:         
  8:         /**
  9:          Precondition: n >= 1.
 10:          Displays the symbol '#' n times on one line
 11:          and then advances to the next line.
 12:         */
 13:         public static void displaySharps(int n)
 14:         {
 15:                 if (n <= 1)
 16:                         System.out.println('#');
 17:                 else
 18:                 {
 19:                         System.out.print('#');
 20:                         displaySharps(n - 1); 
 21:                 }
 22:         }
 23: }