Write a method called makeStars. The method receives an int parameter that is guaranteed not to be negative. The method returns a String whose length equals the parameter and contains no characters other than asterisks.

Respuesta :

ijeggs

Answer:

   public static String makeStars(int num){

       String stars ="";

       for(int i =0; i<num; i++){

           System.out.print("* ");

       }

       return stars;

   }

Explanation:

A complete java program calling the method makeStars and passing an argument of 5 is given below:

public class num1 {

   public static String makeStars(int num){

       String stars ="";

       for(int i =0; i<num; i++){

           System.out.print("* ");

       }

       return stars;

   }

   public static void main(String[] args) {

       System.out.println(makeStars(5));

   }

}