hi, please enclose in braces the lines "i=2; i=i+2;" (sans quotes) in your code. (see below)
>class test { > static boolean check; > public static void main(String args[]) { > int i; > if(check == true) > i=1; > else > i=2; > > if (check == false) > { i=2; i=i+2; } > > else > i = i + 4; > > System.out.println(i); > } >} BR, randy-e At 02:35 PM 01/14/2002 -0800, you wrote: >class test { > static boolean check; > public static void main(String args[]) { > int i; > if(check == true) > i=1; > else > i=2; > > if (check == false) > i=2; i=i+2; > > else > i = i + 4; > > System.out.println(i); > } >} > > >C:\>javac test.java >test.java:13: 'else' without 'if' > else > ^ > >I know this is cause by i=2; i=i+2; >if just i=2, then everthing will be fine, how to make i=2; i=i+2; as a >block, so compiler will not consider it should need another "if" ? > >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 BR, randy-e (ICQ) 24806802 (FAX) +1 (415) 598-2617 =========================================================================== 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