I tried to write a program for question 12 in last year test. But I encounter an error in my program, and I do not know why it is wrong and how to fix it.
1.for (int line = 1; line <= 6; line++) {
2. for (int star = 1; star <= line; star++) {
3. System.out.print("*");
4. }
5. System.out.print(-1*line+7);
6. }
7. for (int hash = 1; hash <= -2*line+14; hash++) {
8. System.out.print("#");
9. }
10. System.out.println();
eclipse show that I have an error in line 7: Multiple markers at this line
- line cannot be resolved to a
variable