• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to store values inside an array?  RSS feed

 
Pooja Patole
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

I have written a program in which i have created many projects. Later i calculated how much time each project takes to be created . The values are of long data type as i am checking the time using System.currentTimeMillis() method. When i get the value i have to store it in an array so that at the end I will have an array which will have all the time values of projects that are created. I want these values to create a graph. Please can someone tell me how to i store these values in an array one by one.??

Thanks
Pooja
 
Pooja Patole
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ex :


I want to store the elapsed time value inside projectCreationTimes array.. How do i do that??? As if i create 5 projects then i wil have 5 elapsed time values in the array.

Pooja
 
John Jai
Rancher
Posts: 1776
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read Java tutorials - Arrays. Also consider using Map<Project Name, Time Elapsed> construct.
 
atinder singh
Greenhorn
Posts: 3
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will find all description with example on this link Java arrays
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
atinder singh wrote:You will find all description with example on this link Java arrays
That is not a good link, I am afraid. Too short, and implies you can have 2D arrays, which is incorrect.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:
atinder singh wrote:You will find all description with example on this link Java arrays
That is not a good link, I am afraid. Too short, and implies you can have 2D arrays, which is incorrect.


Worse, it flat-out states that "1D" and "2D" are two different kinds of array.

Not only that, even if you accept the glossing over in the spirit of "We can treat them as 2D arrays for our purposes when we use them" (which I absolutely do not for begginers), it makes it sound like arrays can only have 1 or 2 "dimensions".

I also glanced over the Exceptions page, just to check it out. It gives the basics of the syntax, but the examples just show it printing out an error message. It doesn't explain at all about the fact that we have to actually handle them if we're catching and not rethrowing.

All in all, NOT a worthwhile site, IMHO.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!