signoff JSP-INTEREST

-----Original Message-----
From: Gare, Trefor [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 15, 2002 3:08 AM
To: [EMAIL PROTECTED]
Subject: Re: A java question.


I'd say:
The static variable i is not explicitly initialized and so is implicitly set
to 0
Therefore the while condition is false from the start (ie: i is not less
than 0), so the loop is skipped and i's initial value is printed.

cheers

Tref Gare
Web Developer MCSD/SCJP
eCommerce Group
Phone:  (03) 9221 4106
Mobile: 0409 556 478
Fax:    (03) 9941 4295

> -----Original Message-----
> From: Miao, Franco CAWS:EX [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday,15 January 2002 8:33
> To:   [EMAIL PROTECTED]
> Subject:      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

===========================================================================
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
This e-mail and any files transmitted with it are for the sole use of the intended 
recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply e-mail and 
destroy all copies of the original message. Any unauthorised review, use, disclosure, 
dissemination, forwarding, printing or copying of this email or any action taken in 
reliance on this e-mail is strictly prohibited and may be unlawful.
Visit us at http://www.cognizant.com

Reply via email to