Really simple java i need help on! - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Really simple java i need help on!

gcookiegcookie Posts: 1Member
I'm brand new to java so the simplest problem is taking me a fair amount of time and effort over.

So don't laugh but does anyone know what i would need to add to my programme to convert a number such a 6 into 6 asterix's (******) ?

There must be a really obvious way to do this, so obvious infact that it is in non of my textbooks. Any suggestions would be greatly appreciated!!!


Comments

  • VilanyeVilanye Posts: 684Member
    : I'm brand new to java so the simplest problem is taking me a fair amount of time and effort over.
    :
    : So don't laugh but does anyone know what i would need to add to my programme to convert a number such a 6 into 6 asterix's (******) ?
    :
    : There must be a really obvious way to do this, so obvious infact that it is in non of my textbooks. Any suggestions would be greatly appreciated!!!
    :
    :
    :
    iterate through a loop n number of times, each time through print an * with no newline.
    [italic][blue]Just my 2 bits[/blue][/italic]

  • SleepMonsterSleepMonster Posts: 4Member
    : I'm brand new to java so the simplest problem is taking me a fair amount of time and effort over.
    :
    : So don't laugh but does anyone know what i would need to add to my programme to convert a number such a 6 into 6 asterix's (******) ?
    :
    : There must be a really obvious way to do this, so obvious infact that it is in non of my textbooks. Any suggestions would be greatly appreciated!!!
    :
    :
    :
    you need a for loop to go through the number of asterix you need and then print that number e.g
    int n = the number you want to print out
    for(int i=0;i
    * @version
    */

    public class Ast{
    public Ast() {

    }

    public static void main(String[] args) {
    int n=6;
    for(int i=0;i<n;i++){
    System.out.print("*");
    }
    }
    }
Sign In or Register to comment.