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

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.