Welcome to Dream.In.Code
Become a Java Expert!

Join 150,149 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 2,364 people online right now. Registration is fast and FREE... Join Now!




ArrayList passed as a parameter

 
Closed TopicStart new topic

ArrayList passed as a parameter

melbourne89
3 Aug, 2008 - 08:34 PM
Post #1

New D.I.C Head
*

Joined: 3 Aug, 2008
Posts: 2

Hi guys. new to the forum.

im trying to code an arraylist of class OrderLine named Order.

i need to make it so that each instantiation of the CLASS Order contains the ArrayList Order.

how can i input the ArrayList into the parameters of the overloading constructor of the class Order

any help will be very much appreciated

CODE


public class Order {

    private int number;
    private static int counter=0;
    private String time;
    private ArrayList<OrderLine> Order;

public Order(String time, ArrayList Order){ //This comes with an error saying cannot find symbol class ArrayList
        this.time=time;
        number = counter+1;
        counter++;
        this.Order=Order;

User is offlineProfile CardPM
+Quote Post

Martyr2
RE: ArrayList Passed As A Parameter
3 Aug, 2008 - 09:06 PM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,660



Thanked: 313 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Make sure you have imported it at the top with this line...

java

import java.util.ArrayList;


ArrayList is part of the java.util package and must be imported to be used. smile.gif


User is offlineProfile CardPM
+Quote Post

melbourne89
RE: ArrayList Passed As A Parameter
3 Aug, 2008 - 09:17 PM
Post #3

New D.I.C Head
*

Joined: 3 Aug, 2008
Posts: 2

QUOTE(Martyr2 @ 3 Aug, 2008 - 10:06 PM) *

Make sure you have imported it at the top with this line...

java

import java.util.ArrayList;


ArrayList is part of the java.util package and must be imported to be used. smile.gif


thanks for that. no problems now

Edited by PBL as Martyr2 answer fixed that problem so topic can be closed

This post has been edited by pbl: 4 Aug, 2008 - 08:10 PM
User is offlineProfile CardPM
+Quote Post

Closed TopicStart new topic
Time is now: 1/9/09 02:31AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month