Article View: borland.public.jbuilder.java.language
Article #7366Simple question from newbie
From: LOL
Date: Mon, 25 Jun 2001 01:24
Date: Mon, 25 Jun 2001 01:24
30 lines
1833 bytes
1833 bytes
I am trying to compare the agument passed in named ID to see whether the
array "code" already has ID in it. No matter what the first loop is not
entered, please tell me how to do this comparison.
I know that this is my problem "if(code[i]==ID)"
Any help will be much appreciated.
public void update(String ID, int quantity, float price1)
{
System.out.println(code[0]);
for(i=0;i<code.length;i++)
{
System.out.println("first for");
if(code[i]==ID)
{
System.out.println("First loop");
break;
}
}
for(i=0;i<code.length;i++)
{
System.out.println("second loop");
if(code[i]==null)
{
code[i]=ID;
break;
}
}
}
Technical Details
Message-ID:
<tpwZ6.10913$25.41212@news1.eburwd1.vic.optushome.com.au>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!128.230.129.106!news.maxwell.syr.edu!news.mel.connect.com.au!newshub1.rdc1.nsw.optushome.com.au!news1.eburwd1.vic.optushome.com.au.POSTED!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,6e54f4bd6a619a59,start X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-06-24 18:24:43 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!128.230.129.106!news.maxwell.syr.edu!news.mel.connect.com.au!newshub1.rdc1.nsw.optushome.com.au!news1.eburwd1.vic.optushome.com.au.POSTED!not-for-mail From: "LOL" <LOL@optushome.com.au> Newsgroups: borland.public.jbuilder.java.language Subject: Simple question from newbie Lines: 32 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: <tpwZ6.10913$25.41212@news1.eburwd1.vic.optushome.com.au> Date: Mon, 25 Jun 2001 01:24:41 GMT NNTP-Posting-Host: 203.164.18.194 X-Complaints-To: abuse@optushome.com.au X-Trace: news1.eburwd1.vic.optushome.com.au 993432281 203.164.18.194 (Mon, 25 Jun 2001 11:24:41 EST) NNTP-Posting-Date: Mon, 25 Jun 2001 11:24:41 EST Organization: @Home Network