Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Looping of particular instruction ith times

  1. #1
    Junior Member
    Join Date
    Jun 2009
    Posts
    24
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Looping of particular instruction ith times

    	static void updateSharePrice(int i){//Start of updateSharePrice method
     
    				System.out.println("Here is your current list of stocks : \n");
    				System.out.print("\t\t\t\tBought Current Stock\n");
    				System.out.println("Stock Name\tSymbol\tUnits\tPrice\tPrice\tValue ");
    				System.out.print("----------\t------\t-----\t-----\t-----\t-----\n");
    				System.out.print(stockName[i]+"\t"+stockSym[i]+"\t"+unitBought[i]+"\t"+unitPrice[i]);
     
     
     
    			}//End of updateSharePrice method
    i have a method that will take int i and put it into the arrays and repeat i times, but i only want
    System.out.print(stockName[i]+"\t"+stockSym[i]+"\t"+unitBought[i]+"\t"+unitPrice[i]);
    to repeat i times, how can i do it??

    i meant this
    This is your current stocks that you have:
    stock1 at 5 dollar each
    stock2 at 6 dollar each
    stock3
    stock4
    etc...


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 286 Times in 225 Posts
    Blog Entries
    4

    Default Re: for loop

    Have you solved this already lotus?
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

  3. #3
    Junior Member
    Join Date
    Jun 2009
    Posts
    24
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: for loop

    yes i figured it out, i used a for loop

Similar Threads

  1. Why won't this while loop work?
    By trueblue in forum Loops & Control Statements
    Replies: 2
    Last Post: July 17th, 2009, 09:10 AM
  2. [SOLVED] Array loop problem which returns the difference between the value with fixed value
    By uplink600 in forum Loops & Control Statements
    Replies: 5
    Last Post: May 15th, 2009, 04:31 AM
  3. [SOLVED] Trouble with draw and fillRect in pyramid logic using nested loop
    By LiquidMetal in forum Loops & Control Statements
    Replies: 4
    Last Post: April 27th, 2009, 03:25 AM
  4. [SOLVED] Java for loop problem and out put is not coming
    By thewonderdude in forum Loops & Control Statements
    Replies: 9
    Last Post: March 15th, 2009, 02:31 PM