Results 1 to 3 of 3
Like Tree2Likes
  • 2 Post By DarrylBurke

Thread: java error 14 / 21 ?

  1. #1
    simco99 is offline Member
    Join Date
    Jan 2012
    Posts
    3
    Rep Power
    0

    Default java error 14 / 21 ?

    still trying to learn java and have hit another snag. I'm trying to program an "if" break on a "for" loop, but it's not working. I have gone over it over and over and have tried starting from scratch 3 times, but still have gotten nowhere. Below is the error that I get. Anyone know what I am doing wrong? *BTW, the characters under the java14 line is actually showing under the 1st "e" in expression).

    C:\Users\myjava>javac break.java
    break.java:14: illegal start of expression
    }
    ^
    break.java:21: reached end of file while parsing
    }→
    ^
    2 errors



    Just in case, here's the program...
    Java Code:
    class Break
    {
    public static void main(String[]args)
    {
    	for(int i=1;i<4; i++)
    	{
    		for(int j=1; j<4; j++)	
    		{
    			if(i==2&&j==1)
    			{
    				if(i==1&&j==1)
    				{
    				System.out.println("Contunues innerLoop when i="+i+"j="+j);contunue:
    				}
    			System.out.println("Breaks innerLoop when i="+i+"j="+j);break;
    			}
    		System.out.println("Running i="+i+"j="+j);
    		}
    	}
    }
    }
    Last edited by Norm; 01-25-2012 at 01:52 AM. Reason: added code tags

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,275
    Rep Power
    25

    Default Re: java error 14 / 21 ?

    reached end of file while parsing
    When you get that error check the code for properly pairing of {}s
    and maybe "s
    I can't tell with your tightly packed code if the "s are correctly paired.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: java error 14 / 21 ?

    Java Code:
    contunue:
    Really?

    db
    Tolls and Norm like this.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 16
    Last Post: 01-11-2012, 02:45 PM
  2. Replies: 0
    Last Post: 01-21-2011, 12:43 PM
  3. java out of memory error-heap space error
    By elsanthosh in forum NetBeans
    Replies: 4
    Last Post: 06-15-2010, 09:31 AM
  4. Replies: 1
    Last Post: 12-05-2009, 07:28 AM
  5. Replies: 1
    Last Post: 10-26-2009, 04:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •