I have to write a program that takes two inputted characters and print them out x
times using a method. With what I have so far, it will output numbers instead of the characters. How can I fix it?
int length;
char ch1;
char ch2;
System.out.print("Enter a character: ");
ch1 = input.nextLine().charAt(0); //input refers to scanner.
System.out.print("Enter second character: ");
ch2 = input.nextLine().charAt(0); //input refers to scanner.
System.out.print("Enter the length of the line: ");
length = input.nextInt(); //input refers to how many times the characters ar$
draw_line(length, ch1, ch2);
//Method starts here.
public static void draw_line(int length, char ch1, char ch2){
for (int i = 0; i < length; ++i){
System.out.print(ch1 + ch2);
}
}