Homework help. Counting the number of times an integer occurs in Array

Hey everyone! I figured I would go ahead and say hello since I am new to the site. Anyway. Here is my question:

Write a method that will find the number of occurrences of a specified integer in an array of integers. Assume that the array is full of valid data.

I am unsure of how to begin this program and have been staring at it for a couple hours trying to get everything worked out but nothing I am doing seems to work.

Any help would be great.


  • hi there, I'm also learning Java at my school. I may or may not be able to help you with this as I am still a newb, but I'll try.
    First of all, can you make an array? I would start with that. For example...

    I'll make an array and call it 'list'.

    int[] list = new int[10];

    this array is of type int as u can see. I named it 'list' and it has 10 indexes which are 0 through 9.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion