Guest User

Untitled

a guest
Jun 21st, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. public class Quadrat{
  2.  
  3. int laenge;
  4.  
  5.  
  6. public Quadrat(){
  7. quadrat(5);
  8. }
  9.  
  10. public void quadrat(int laenge){
  11. int hoehe = laenge;
  12.  
  13. for (int i = 1; i <= laenge; i++) {
  14. for (int j = 1; j <= hoehe; j++) {
  15. if (i == 1 || i == laenge || j == 1 || j == hoehe) { // zeichnet in der ersten und letzten Zeile / Spalte "*"
  16. System.out.print("*";
  17. }
  18. else {
  19. System.out.print(" ";
  20. }
  21. }
  22. System.out.println();
  23. }
  24. }
Add Comment
Please, Sign In to add comment