you know what u talking about, I know how to do this part, but let me make
myself more clear

here is the modified code:

-----------------------------------------------------------------------
public class test2 {
public static void main(String args[]) {
 int m = 2;
 int p = 1;
 int t = 0;
 for(;p < 5;p++) {
 if(t++ > m) {
 m = p + t;
 }
 }
 System.out.println("t equals " + t);
  System.out.println(m);
  System.out.println(p);
  System.out.println(t);

 }
 }

----------------------------------------------------------------

C:\>java test2
t equals 4
8
5
4

Q: why m=8,
    p=5 (;p < 5;p++) p is limited below 5, why now p=5?
    int t=0, and "if (t++>m)", looks like impossible, because t=0, t++=0
still, why t=4 now?
    how they calculate this result?




Franco


-----Original Message-----
From: King Maurice [mailto:[EMAIL PROTECTED]]
Sent: Sunday, January 06, 2002 4:34 PM
To: [EMAIL PROTECTED]
Subject: Re: A Java question


No, when you do a system.out.println();

In your ide, your suppose to see the print statements, thus leading you how
the program exe each iteration of the algorithmn, giving you clues how the
program becuase to be.....

So for example

if my program is this

int m = 0
for (int x = 0; x < 10; x++)
{
    m = x + 1;
    System.out.println("here is the value of m " +m+ "<br> here is the value
of x" +x+ "");
}

The system.outprintln will give you the following

here is the value of m 2
here is the value of x 1
here is the value of m 3
here is the value of x 2
here is the value of m 4
here is the value of x 3
etc........
etc........

After my example you don't understand what I am talking about, I suggest
taking a course or buying a book

----- Original Message -----
From: "Miao, Franco CAWS:EX" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, January 06, 2002 7:27 PM
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

===========================================================================
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

Reply via email to