Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: illegal character: \8206???

  1. #1
    Member
    Join Date
    Apr 2013
    Posts
    83
    Thanks
    7
    Thanked 3 Times in 3 Posts

    Default illegal character: \8206???

    my head is wrecked i have code below the if is fine but the else if throws error at bottom
    String var="";
    String laninsert="";
    if(var.equals("Namibia")|var.equals("South Africa")){
            laninsert="no,af,en-us";
    }else if (var.equals("Albania"‎‎)|var.equals("Kosovo‎")|var.equals("Spain")){  //this line throws error
            laninsert="no,sq,en-gb";
    }

    this is the error :
    illegal character: \8206
     
    illegal character: \8206
     
    ';' expected

    this could just be something stupid thats staring me in the face but aaargh im seeing double at this stage


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: illegal character: \8206???

    An 'or' is a double bar, '||'.

  3. #3
    Member
    Join Date
    Apr 2013
    Posts
    83
    Thanks
    7
    Thanked 3 Times in 3 Posts

    Default Re: illegal character: \8206???

        if(var.equals("Namibia")||var.equals("South Africa")){
            laninsert="no,af,en-us";
        }
        if(var.equals("Albania"‎‎)||var.equals("Kosovo‎")||var.equals("Spain")){
            laninsert="no,sq,en-gb";
            }
    still give same error thanks alot for reply

  4. #4
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: illegal character: \8206???

    Check braces brackets etc...
    The snippet shown seems okay, post the rest of the code if you can not find the error

  5. #5
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: illegal character: \8206???

    Quote Originally Posted by GregBrannon View Post
    An 'or' is a double bar, '||'.
    A single bar is perfectly fine for an "or".

    Usually you get that message if you have copied/paste code from a word processor which uses character codes that the java compiler does not know about.
    Improving the world one idiot at a time!

  6. The Following User Says Thank You to Junky For This Useful Post:

    bean (August 9th, 2013)

  7. #6
    Member
    Join Date
    Apr 2013
    Posts
    83
    Thanks
    7
    Thanked 3 Times in 3 Posts

    Default Re: illegal character: \8206???

    Quote Originally Posted by Junky View Post
    A single bar is perfectly fine for an "or".

    Usually you get that message if you have copied/paste code from a word processor which uses character codes that the java compiler does not know about.
    i think that was the problem i wrote it in gedit and pasted to ide in the end i got fed up and deleted the code and went to bed next day ireworte it and was fine

Similar Threads

  1. Help With illegal start of expression
    By inshal in forum What's Wrong With My Code?
    Replies: 6
    Last Post: February 9th, 2013, 01:20 PM
  2. need help with illegal start of expression
    By inshal in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 9th, 2013, 11:25 AM
  3. [SOLVED] Illegal character
    By Tank314 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: March 12th, 2011, 11:59 AM
  4. Illegal start
    By hing09 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: March 25th, 2010, 05:23 PM
  5. The character '' is an invalid XML character exception getting
    By sumanta in forum What's Wrong With My Code?
    Replies: 5
    Last Post: January 9th, 2010, 12:13 PM