I thought having println() at the end is adding an extra empty line and that is the problem but even after adding a condition (If condition) such that there are exactly 2 rows and no extra empty rows, still I see the same error
package com.codegym.task.task04.task0436;
/*
Drawing a rectangle
*/
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
Scanner sc = new Scanner(System.in);
int m = sc.nextInt();//2
int n = sc.nextInt();//4
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 4; j++) {
System.out.print(m*n);
}
/* if (i == 0) {
System.out.println();
}
*/
System.out.println();
}
}
}