I have declared an Array like this int hourCounts; and in my constructor class I created one - new int. What method do I use to retrieve the number in a given array. Any help would be greatly appreciated.
Welcome to the Ranch
Before getting anything out of an array, you have to put it in. Is this Java Tutorials section any use to you?
At least with ints and other primitive arrays you get something vaguely useful out if you haven’t put anything in: 0. If you have an array of reference types and don’t put anything in, you get null back. And nulls can have nasty side‑effects.
I have had a look at that Java Tutorials link, and I think it will help you.
Joined: Feb 17, 2013
Thanks, my instructor pointed me to this forum. With an instructor that is almost inaccessible it is good have a resource like this one.
I figured out what I was doing wrong. I was looking for a method to retrieve the int value from my array when all I needed was int IndexValue = hoursCount; To get the value of the index at 5 in my array.