I didn't realize i will be initiated as 0 if it is not be specified, so you guys mean i=0 is system default?
Franco -----Original Message----- From: Gare, Trefor [mailto:[EMAIL PROTECTED]] Sent: Monday, January 14, 2002 1:38 PM 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 =========================================================================== 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
