Advertisement
Svetlana_Ovsjanikova

java - stars

Sep 21st, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package day2_loops;
  7.  
  8. import java.util.Scanner;
  9.  
  10. /**
  11. *
  12. * @author sao_7
  13. */
  14. public class Day2_loops {
  15.  
  16. /**
  17. * @param args the command line arguments
  18. */
  19. public static void main(String[] args) {
  20. stars();
  21.  
  22. }
  23. public static void loops(){
  24. //for, while,do..while, for-each
  25. for(int i = 0; i<5; i++){
  26. System.out.println(i);
  27. }
  28. }
  29.  
  30. public static void stars(){
  31. //*
  32. //**
  33. //***
  34. //****
  35. String output = "";
  36. for(int i = 0; i<4; i++){
  37. output = output + "*";
  38. System.out.println(output);
  39. }
  40. }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement