Link to home
Start Free TrialLog in
Avatar of bt1942
bt1942

asked on

Please check this code if it's right.

The question is:
The output to the screen (console/terminal window) produced by the running the following code?

and the answer would be :  "****" without double quotation marks.

is this right?


public void printStars()
{
    int n = 4;
    String s = "****";
 
    for(int row = 1; row<= n; row++)
    {
        System.out.println(s);
    }
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Gregory Miller
Gregory Miller
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bt1942
bt1942

ASKER

Technodweeb//  Hi thanks for the reply, I have one more question.
                           what code makes them become 4rows?
                           Is it the int n = 4;
No, use system.out.println to add a new line after the output and use system.out.print to leave the cursor at the end of the output so that the next output will be suffixed immediately after the first.
Avatar of bt1942

ASKER

Thanks for the comment!