Java Programming Tutorial - 29 - Summing Elements of Arrays

Loading...

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

Uploaded by on May 15, 2009

How to sum the elements of an array in java.

  • likes, 8 dislikes

Link to this comment:

Share to:

Top Comments

  • 2 days ago a was a 22 years old university student that was studying computer engineering and tried to cheat my Java exams. After im done with these tutorials my teacher is going to cheat so she can give me less points in the upcoming exams.

  • theze ftw

see all

All Comments (200)

Sign In or Sign Up now to post a comment!
  • @rymantas59 I don't believe he is actually in a university. After all he called his Professor a teacher -_-

  • People know Java but they don't know English

  • @rymantas59 They probably go to ITT Tech or the we don't care give us money school if you prefer.

  • @MusicRevelance You are 22 year old and you dont know how to play with arrays? What a fukcing university you go to?

  • @EntropyVX Oh, okay. I understand, now. I should've realized that before... Thanks.

  • @Lennybird91 The + is simply adding the variable to the println statement.

    System.out.println("some stuff:" + sum + "some more stuff " + sum + "yet more stuff");

  • @Lennybird91 It does seem a bit odd to have to use a '+' before sum, but the fact remains that no matter what you pack on other than the initial "The sum of ____ is", will need one. So when you think about it, you still are adding -in a sense- to the rest of the println. Hope that helps... Somehow.

  • @BigRunescapeBrain Counter-Grammar-Nazi-Activated­: It's "it's," not "its" when not discussing possession. ;-)

    As for what you pointed out, we fall into vague territory. Considering words such as "team" or "group" when in unison are both still singular, one might question whether the "sum" is behaving as singular. This of course depends, as I've neglected to remember the importance prepositional phrases ("of these numbers") when noting the plurality of the verb. Doh.

  • I'm having difficulty understanding why one can't simply output ..."The sum of these numbers is " sum); Why all of the sudden, after appending the sum+=bucky[counter];, do you have to use +sum?

  • @RiaAndPreetiAntics You could use nested for loops, one dimension inside of the other.

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