Since i starts out a 0, the flow through the code goes something like this.

1. Initialize the static variables, sets i to the default value of 0 since
it isn't specified.
2. Start executing the main method
3. Test whether i is less than 0.  Since i is 0 the loop is never entered.
4. Print out the value of i.
5. Exit

(*Chris*)

----- Original Message -----
From: "Miao, Franco CAWS:EX" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 14, 2002 1:32 PM
Subject: [JSP-INTEREST] A java question.


> class xyz {
>     static int i;
>     public static void main(String args[]) {
>
>         while (i < 0) {
>             i--;
>         }
>         System.out.println(i);
>     }
> }
>
> why it come out 0? I guess variable i has not have been initialized, so
i--
> will not be processed.
>
> 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


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.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