Results 1 to 10 of 10
  1. #1
    anthonyalaan is offline Member
    Join Date
    Sep 2010
    Posts
    3
    Rep Power
    0

    Default Need really basic help!

    So I'm trying to create a helloWorld program in Java but for some reason when I enter the code into Eclipse and Netbeans they give me errors. In Netbeans it gives me this error:

    illegal character: \8220

    illegal character: \8221

    Here's my code:

    package helloworld;

    public class Main {

    public static void main(String[] args)

    {
    System.out.println (“Hello World”);
    }
    }

    I can't even start to program Java for my class and am now three weeks behind as it is online. Please help asap!!! Thanks.

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

    Default

    Does the IDE show which line in your program the error is on?

    Can you look at the Main.java file with a text editor and see if there are any unusual characters in it?

  3. #3
    anthonyalaan is offline Member
    Join Date
    Sep 2010
    Posts
    3
    Rep Power
    0

    Default

    Sorry. Forgot to mention that the errors are all popping up from line 7:

    System.out.println (“Hello World”);

    I opened the java file in notepad and didn't see any foreign characters.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,266
    Rep Power
    25

    Default

    When you post it in BOLD, it is easier to see. Your enclosing quotes are not what the compiler is used to. It wants this: " Or in Unicode: \u0022
    You must have a different keyboard.

    If you don't have the " character you could try this:

    System.out.println(\u0022Hello World\u0022);

  5. #5
    anthonyalaan is offline Member
    Join Date
    Sep 2010
    Posts
    3
    Rep Power
    0

    Default

    So I figured out why is wasn't working. You were right. I copied and pasted the code from another source and I guess the " was somehow different from the standard. Just a simple delete and re-enter was all it took. So simple yet so troublesome for me. I hope this isn't a bad precursor to my whole semester.... Thanks!
    Last edited by anthonyalaan; 09-12-2010 at 02:59 AM.

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,266
    Rep Power
    25

    Default

    It could be, with your keyboard. There are other keyboard tricks for entering characters via a keyboard. Try holding down the ALT key and pressing the 3 and 4 key and then releasing the ALT key. On my keyboard I get: "

    Good luck.

    PS what try of keyboard do you have?

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

    Default

    Quote Originally Posted by Norm View Post
    It could be, with your keyboard. There are other keyboard tricks for entering characters via a keyboard. Try holding down the ALT key and pressing the 3 and 4 key and then releasing the ALT key. On my keyboard I get: "

    Good luck.

    PS what try of keyboard do you have?
    I don't think it has anything to do with keyboards; the OP just copied and pasted a piece of text from some electronic source (formatted text); that's how those funny quotes made it in the source. That serves them for lazily copying and pasting stuff ;-)

    kind regards,

    Jos

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,266
    Rep Power
    25

    Default

    Could be. I had a keyboard problem in Costa Rica. There was no @. Made it very hard to do email until I was shown the ALT ## trick.

  9. #9
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    ... and let me guess -- you got to Costa Rica by sailing there. Must be rough!

  10. #10
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,266
    Rep Power
    25

Similar Threads

  1. Basic java
    By santa in forum New To Java
    Replies: 5
    Last Post: 11-16-2009, 10:16 AM
  2. Basic Help
    By robjames in forum New To Java
    Replies: 3
    Last Post: 02-09-2009, 02:58 AM
  3. Need some really basic help
    By Mayur in forum New To Java
    Replies: 6
    Last Post: 01-24-2009, 06:00 AM
  4. Basic Applet
    By jkswebsite in forum Java Applets
    Replies: 4
    Last Post: 01-13-2008, 09:14 PM
  5. help with basic example
    By fred in forum New To Java
    Replies: 1
    Last Post: 07-20-2007, 05:45 PM

Tags for this Thread

Posting Permissions

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