Results 1 to 4 of 4
  1. #1
    13ponchera is offline Member
    Join Date
    Oct 2010
    Posts
    1
    Rep Power
    0

    Exclamation illegal character: \8233

    This code should compile the mathmatical calculations were given to us by our teacher but for some reason one line will not compile even though there are not any syntax errors




    public class Easter
    {
    private int day;
    private int month;
    private int year;

    public Easter(int y)
    {
    year = y;

    int a = y % 19;
    int b = y / 100;
    int c = y % 100;
    int d = b / a;
    int e = b * 4;
    int g = (8 * b + 13) / 25;
    int h = (19 * a + b - d - g + 15) % 30;
    int j = c / 4;
    int k = c % 4;
    int m = (a + 11 * h)% 319;





    int r = (2 * e + 2 * j – k – h + m + 32) % 7;


    // the line above will not compile ++ error message = illegal character: \8211
    // whats wrong


    int n = (h - m + 5 + 90) % 25;
    int p = (h - m + 6 + n + 19) % 32;

    day = p;
    month = n;
    }


    public int getYear()
    {
    return year;
    }


    public String getMonth()
    {
    String m;
    if (month == 1)
    m = "January";
    else if (month == 2)
    m = "february";
    else if (month == 3)
    m = "March";
    else if (month == 4)
    m = "April";
    else if (month == 5)
    m = "May";
    else if (month == 6)
    m = "June";
    else if (month == 7)
    m = "July";
    else if (month == 8)
    m = "August";
    else if (month == 9)
    m = "September";
    else if (month == 10)
    m = "October";
    else if (month == 11)
    m = "November";
    else if (month == 12)
    m = "December";
    return m;
    }

    public int getday()
    {
    return day;
    }

    public String toString()
    {
    String str = "easter durring " + getYear() + " is the " + getDay() + " of " + getMonth();
    return str;
    }
    }
    // 2001 should be april 15





    HELP:(:(:(:(:(:(:(:

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,891
    Rep Power
    25

    Default

    one line will not compile
    What keyboard are you using?
    Which character in the source line you posted is the invalid one?
    What key did you press to enter the - operator?

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default

    Quote Originally Posted by Norm View Post
    What key did you press to enter the - operator?
    <Ctrl>-V

    db

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,773
    Blog Entries
    7
    Rep Power
    21

    Default

    I bet the OP copied and pasted a piece of code from formatted text; in MS Ariel Unicode the character 8211 (2013 in hexadecimal) displays as a wide minus sign ('en dash'). That should teach the OP not to copy/paste stuff but instead should be typed in.

    kind regards,

    Jos

Similar Threads

  1. Illegal expression
    By Thumper in forum New To Java
    Replies: 82
    Last Post: 12-11-2009, 09:34 AM
  2. Read from a certain character to a certain character
    By blackstormattack in forum New To Java
    Replies: 0
    Last Post: 03-16-2009, 12:36 PM
  3. illegal character: \92
    By jlgraham in forum New To Java
    Replies: 3
    Last Post: 06-29-2008, 10:04 AM
  4. illegal character: \65279
    By iwax in forum New To Java
    Replies: 3
    Last Post: 01-30-2008, 03:52 PM
  5. reading text character by character
    By bugger in forum New To Java
    Replies: 2
    Last Post: 11-09-2007, 09:54 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
  •