3.1 constructor using object (f) int a5 =

 

3.1 

import java.util.ArrayList;

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

 

public class Homework1{

 

                public
static void main(String args){

 

                                ArrayList
list = new ArrayList();

 

                                for(int
i = 0; i plist)

{

                int sum
= 0;

                for
(Integer d:plist)

                sum =
sum + d;

                return
sum;

                }

}

 

 

3.5

 

public ArrayList arrayListCreate(int pLen,
int pInitValue){

               

                ArrayList
list = new ArrayList(pLen);

               

                for
(int i=0; i