Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Java Programming Tutorial - 30 - Array Elements as Counters

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
145,093
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on May 15, 2009

How to store counting variables in an array index.

  • likes, 9 dislikes

Link to this comment:

Share to:

Top Comments

  • thumps up if you have watched all the tutorials before this one

  • I remember when i was confused wit System.out.println....

see all

All Comments (317)

Sign In or Sign Up now to post a comment!
  • around 2:15 .. It doesn't loop it 1000 times it loops it 999 since you put roll<1000 with it starting at 1. If it was starting at 0 or roll<=1000 then it would be 1000 times.

  • this one's pretty cool :D thanks

  • @dragonthewatcher public static void wait (int n){ long time0,ttime1; time0=System.currentTimeMillis­(); do{ time1=System.currentTimeMillis­(); } while (time1-time0<1000); } sorry about the dodgy formatting
  • Face Frequency

    1 182

    2 182

    3 161

    4 167

    5 154

    6 153

    i didnt get a 0...

  • im confused... how do i make a delay?i tried doing a for loop with for(int counter=0;counter<=99999999999­;counter++){

    }

    System.out.println("suddenly a hand shoots from the mist") but it still does it instantly....

  • @ThatRandomNoob They accomplish the same thing, the only difference is that Math.random does not need you to instantiate an object first (like rand) before you use it. The method .nextInt is a method of both the Random and Scanner classes. When used with the Scanner class, it looks for the next integer that the user input, but with the Random class, it generates a random integer within the range you gave.

  • What is the difference between the rand.nextInt(6) and Math.random*(6) ? Also what does the .nextInt method do, and can it be applied to anything else?

  • first i was learning c++, it took me forever to learn somting, then i met this tutorials, now i'm learning java, because it's a loth easyer to follow you, then a lame text!

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more