Hello friends, Now in this blog, you'll learn Print the Solid Rectangle in Java. In the earlier blog, I have shared Print the Solid Rectangle in Java.
import java.util.Scanner;
public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter the number of Rows: "); int a = sc.nextInt(); System.out.print("Enter the number of Columns: "); int b = sc.nextInt(); for (int i = 1; i <= a; i++) { for (int j = 1; j <= b; j++) { System.out.print("*"); } System.out.print("\n"); } } }