Results 1 to 2 of 2
- 06-02-2010, 11:08 PM #1Member
- Join Date
- Jun 2010
- Rep Power
How do I modify the values in an object array?
Hello, I am new to these forums, and i would like to know how one would go about modifying the values for a particular object in an object array.
For example, say I had a constructor for an object of type "Car", having 2 integer variables, written in "Car" class.
I then create an array of type "Car" with a length of 10 in my test class.
How would I modify the 2 integer values?
Would I need a mutator method in my Car class to do this?
Thanks for your help ahead of time. :)
Yes, a mutator method or "setter" would probably be your best bet here.
Welcome to the Java-Forums.com by the way!
- By thesinter in forum New To JavaReplies: 3Last Post: 01-20-2010, 06:19 AM
- By camper2 in forum New To JavaReplies: 4Last Post: 04-05-2009, 03:13 AM
- By Pooja Deshpande in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 03-17-2009, 12:55 PM
- By nn12 in forum New To JavaReplies: 0Last Post: 11-21-2008, 09:17 AM
- By Judoon_Platoon in forum Java AppletsReplies: 2Last Post: 05-21-2008, 08:07 AM