look at line7, the stars method is defined to take String as input.
you call the stars method on line13, but you did not feed it a String.
the variable star on line7 only has scope inside the stars method.
the variable star on line13 is undefined.
so to fix your problem you could do it several ways.
#1: use a string literal when calling your method on line13
you could just as easily use any String as the input
#2: change the method declaration on line7 so it doesn't take any input arguments.
then you'd call the method like this:
#3: another way to fix it would be to declare a new variable named star which has scope in your printStars method. it would need to be of type String, since that's what your method on line7 was defined as taking.
variables are only usable in the block that they were declared, and you can reuse the same name in different code blocks. make sure to learn about local variables, global variables, and the scope resolution operator. you can also access variables from other classes using a dot, for example if you have a class named Galaxy and a class named Milkyway, you can do Galaxy.star or Milkyway.star to access the star variable inside those classes from another class. you can also use getters and setters to do it.
Here's a quick way to print your stars. I left your code mostly intact, but I totally agree, the "stars()" method needs to go as it adds nothing to simply the code. A simple System.out.println() statement in your printStars() method would be more semantically logical.
In your code below I updated, I created a final static variable at the top for the star character.
I also made your helper methods private. You want to preserve "Encapsulation" as much as possible so keep methods private you don't need to access outside your classes.
I renamed your loop variable to be more self-documenting.