//----------------------------------------------------------------- // This is a "method-based" program to print a sequence of '*' followed by // sequence of '+', followed by '-'. // This is more readable and less repetitive than the program // print_using_main_only.java which does not use any methods (except main) //----------------------------------------------------------------- class print_stars_plus_minus { public static void Print_multiple_chars(int i, char c) //This method prints i times the character c { int k=0; for(k=1;k<=i;k=k+1) System.out.print(c); } public static void main(String args[]) { int j=5; Print_multiple_chars(j,'*'); Print_multiple_chars(j+1,'+'); Print_multiple_chars(j+2,'-'); System.out.println(""); } }