# Thread: Help with Array List

1. Member
Join Date
Jan 2013
Posts
2
Rep Power
0

## Help with Array List

I'm a newbie in Java and am currently learning Array List. If any of you will be so kind,I need to complete these basic exercises with for loops but I'm not sure how to set it up.
Programming Exercises for Chapter 46

2. Member
Join Date
Oct 2011
Posts
92
Rep Power
0

## Re: Help with Array List

First things first. We aren't going to do your work for you. List out the exercises that you want help with, and we'll give you guidance.

3. Member
Join Date
Jan 2013
Posts
2
Rep Power
0

## Re: Help with Array List

I understand.
Then for the 1st exercise, this is what i got as of now, unsure of what to add in the for loop.

class Exercise1
{
public static void main ( String[] args )
{
int[] val = {0, 1, 2, 3};

for(int i;i<=3;i++)
{
val
}
sum = val

System.out.println( "Sum of all numbers = " + sum );

}
}

4. Member
Join Date
Jan 2013
Location
england
Posts
9
Rep Power
0

## Re: Help with Array List

in your program code there are several things to look at..
you need to give the variable i an initial value
you need to declare what type of variable sum is and give it an initial value
the expression(formula) within your for loop for the running total i.e. sum = sum + val[i]

5. Member
Join Date
Oct 2011
Posts
92
Rep Power
0

## Re: Help with Array List

Originally Posted by serotonin
in your program code there are several things to look at..
you need to give the variable i an initial value
you need to declare what type of variable sum is and give it an initial value
the expression(formula) within your for loop for the running total i.e. sum = sum + val[i]
We don't tell people how to do their homework. We give them guidance, links, lessons etc.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•