at line 1(ie as indicated ------------------->(1) ) ,I can never reach table[i] =table[j] ,but still the code executes and if possible plz expalin how the code works. I tried but i am very confused. Plz explain me passing array refernces ,if possible or let me know where can i chekc it out in detail.
[ EJFH: Added UBB Code tags ] [ January 07, 2005: Message edited by: Ernest Friedman-Hill ]
author and iconoclast
is an instruction, not a test. It means that Java should take the value in table[i], and copy it into table[j]. The "=" operator always means this. The "==" operator -- two equals signs together -- is a test for equality.
Joined: Aug 19, 2004
I got it .Thanks for the reply.
But I got stuck up again when I started to work out i get
the output as
dataSeq =6 dataSeq =8 dataSeq =2
but never able to reach dataSeq and dataSeq
Thanks Once again to help me out.
Joined: Jul 30, 2003
It works for me. When I run your program, I get:
Give a man a fish, he'll eat for one day. <br />Teach a man to fish, he'll drink all your beer.<br /> <br />Cheers,<br /> <br />Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
Joined: Dec 29, 2004
I'm not sure what you did. The first code you posted executes exactly as it should.
To me it looks like the first pass of a bubble sort. If it is you would need to add another for loop around the first one to loop the lenght of the array.
If not it would help if you were to explain what you are trying to do.