Do you realize how the post increment operator (t++ and p++) works?
in: for(;p < 5;p++) {
when p is 4, the iteration is taken, and p is incremented to 5 after the
virtual machine accepts the iteration.
in: if(t++ > m) {
t gets incremented when the if condition is evaluated regardless of whether
the branch is taken or not.
> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Miao, Franco CAWS:EX
> Sent: Sunday, January 06, 2002 7:28 PM
> To: [EMAIL PROTECTED]
> Subject: Re: A Java question
>
>
> tried your way but got following error.
>
> symbol : variable AlgorithmCalculations
> location: class test2
> System.out.println(AlgorithmCalculations);
> ^
> 1 error
>
> Franco
>
>
> -----Original Message-----
> From: King Maurice [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, January 05, 2002 11:45 PM
> To: [EMAIL PROTECTED]
> Subject: Re: A Java question
>
>
> opps my bad~
>
> If you ever want to know how your algorithm became to be, try
> inserting some
> System.out.println(algorithmcalculations);
> or
> out.println(algorithmcalculations);
>
> Then you will see how the values added etc~
>
>
> ----- Original Message -----
> From: "King Maurice" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, January 06, 2002 2:43 AM
> Subject: Re: A Java question
>
>
> > If you ever want to know how your algorithm became to be, try inserting
> some
> > System.out.printlnalgorithmcalculations);
> > or
> > out.printlnalgorithmcalculations);
> >
> > Then you will see how the values added etc~
> >
> > ----- Original Message -----
> > From: "Miao, Franco CAWS:EX" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Sunday, January 06, 2002 2:30 AM
> > Subject: A Java question
> >
> >
> > > 1. public class TeSet {
> > > 2. public static void main(String args[]) {
> > > 3. int m = 2;
> > > 4. int p = 1;
> > > 5. int t = 0;
> > > 6. for(;p < 5;p++) {
> > > 7. if(t++ > m) {
> > > 8. m = p + t;
> > > 9. }
> > > 10. }
> > > 11. System.out.println("t equals " + t);
> > > 12. }
> > > 13. }
> > >
> > >
> > > Compile and run it, t=4. Don't know why?
> > >
> > > Can anyone give me some clue how it is caculated, thanks!
> > >
> > > Franco
> > >
> > >
> >
> ==================================================================
> =========
> > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > DIGEST".
> > > Some relevant FAQs on JSP/Servlets can be found at:
> > >
> > > http://archives.java.sun.com/jsp-interest.html
> > > http://java.sun.com/products/jsp/faq.html
> > > http://www.esperanto.org.nz/jsp/jspfaq.jsp
> > > http://www.jguru.com/faq/index.jsp
> > > http://www.jspinsider.com
> > >
> >
> >
> ==================================================================
> =========
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> > http://archives.java.sun.com/jsp-interest.html
> > http://java.sun.com/products/jsp/faq.html
> > http://www.esperanto.org.nz/jsp/jspfaq.jsp
> > http://www.jguru.com/faq/index.jsp
> > http://www.jspinsider.com
> >
>
> ==================================================================
> =========
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://archives.java.sun.com/jsp-interest.html
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.jsp
> http://www.jguru.com/faq/index.jsp
> http://www.jspinsider.com
>
> ==================================================================
> =========
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set
> JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://archives.java.sun.com/jsp-interest.html
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.jsp
> http://www.jguru.com/faq/index.jsp
> http://www.jspinsider.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com