Best Pattern Questions In Java | Hollow Rectangle| Java For Beginners| #shorts #javaprogramming

preview_player
Показать описание
Best Pattern Questions In Java | Hollow Rectangle| Java For Beginners| #shorts #javaprogramming #funwithcode @FunWithCode-FWC #programming #programminglanguage #program #java #javatutorial #javabeginner #coding #

Under section 107 of the copyright Act 1976, allowance is mad for FAIR USE for purpose such a as criticism, comment, news reporting, teaching, scholarship and research. Fair use is a use permitted by copyright statues that might otherwise be infringing. Non- Profit, educational or personal use tips the balance in favor of FAIR USE.

#FunWithCode
Рекомендации по теме
Комментарии
Автор

import java.util.*;

public class HollowRectangle {
public static void main(String[] args) {
int n = 4;
int m = 5;

// outer loop
for (int i = 1; i <= n; i++) {
// inner loop
for (int j = 1; j <= m; j++) {
// cell -> (i, j)
if (i == 1 || j == 1 || i == n || j == m) {
System.out.print("*");
} else {
System.out.print(" ");
}
}
System.out.println();
}
}
}

FunWithCode-FWC
join shbcf.ru