Go Back   Buyer Forums > Buyer Deals > Freebies

Reply
 
LinkBack Thread Tools Display Modes

How to add one item to the first free space of an array? Dr Java?
  #1 (permalink)  
Old 12-02-2011, 02:12 AM
what what is offline
Junior Member
 
Join Date: Mar 2010
Posts: 2
Default How to add one item to the first free space of an array? Dr Java?

Currently, I have the code:

public void addNum(double number)
{
for(int i = 0; i < items.length; i++){
items[i] = number;
}
System.out.println( number + " added to array.");
}

This adds the added number to every zero spot in the array. How could I make it only add the the first zero spot it comes across?

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump



All times are GMT. The time now is 07:51 PM.


Support by: AmpedGaming
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.