Java '.class' expected, simple but im not seeing it

I'm working on a project right now and need to list 3 parellel arrays. This is what my compiler error looks like.

[quote] '.class' expected

')' expected [/quote]

It's really bugging be, so here are the two methods.

This is the code that my info is being sent to. This method is in a class named ListPets

publicvoid listPets(String[] name,double[] price,int[] quanity)

{

for(int i = 0; i<name.length; i++)

{

output+="\n"+name[i]+""+price[i]+" "+quanity[i];

}

}

this is what is being sent to it

This code is in a class called MainGui

I also have this little bit at the top.

ListPets panList =new ListPets();

publicvoid actionPerformed(ActionEvent ae)

{

panList.listPets(petname[], petprice[], petquanity[]);

}

I feel like im over looking somthing, but i cant find it. Any help on this would be nice, thanks,>

[1488 byte] By [Cobbweba] at [2007-10-2 10:14:37]
# 1

> panList.listPets(petname[], petprice[] , petquanity[]);

You are trying to call a method in the line of code above. So you should only include the variable names, like thispanList.listPets(petname, petprice, petquanity);

Some feedback on your design: It looks like you have (at least) 3 arrays whose contents relate to each other. That is, petname[2] is a pet type's name, petprice[2] is the same pet type's price and petquantity[2] is the same pet type's quantity. In Java, you should not use "parallel arrays" to associate the contents of arrays. Instead, you should have a class - that's the whole idea of object oriented programming.

atmguya at 2007-7-13 1:38:21 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2
Should I make the "petname petprice and petquanity" a class even if each only holds one piece of data? What I mean is, for instance, the petprice would hold the value 550.25 (a double) but nothing more than that. Should I still make each one a diffrent class? BTW Thanks for the
Cobbweba at 2007-7-13 1:38:22 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 3

> Should I make the "petname petprice and petquanity" a

> class even if each only holds one piece of data? What

> I mean is, for instance, the petprice would hold the

> value 550.25 (a double) but nothing more than that.

> Should I still make each one a diffrent class?

>

> BTW Thanks for the help

You are welcome. No, I did not mean a separate class for each variable. I meant a class that holds the related variables, for example PetItem. It sounds like you have an inventory of pet stuff so may be each 'thing' in the inventory is a PetItem. The PetItem has a name, price and quantity - maybe more.

atmguya at 2007-7-13 1:38:22 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...