File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why can't it compile ?

 
WeiJie Lim
Ranch Hand
Posts: 92
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why can't the following code be compiled ? Any help is appreciated, thanks =)

 
Stuart A. Burkett
Ranch Hand
Posts: 679
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WeiJie Lim wrote:Why can't the following code be compiled ?

What makes you think it won't compile ? If you get compiler errors you need to tell us what they are.
 
WeiJie Lim
Ranch Hand
Posts: 92
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stuart A. Burkett wrote:
WeiJie Lim wrote:Why can't the following code be compiled ?

What makes you think it won't compile ? If you get compiler errors you need to tell us what they are.


I tried compiling it, it wouldn't be compiled.

The errors are repeated.

dum1.java:4: error: illegal character: \160
    static Scanner sc = new Scanne
^
dum1.java:4: error: illegal character: \160
    static Scanner sc = new Scanne
^
dum1.java:4: error: illegal character: \160
    static Scanner sc = new Scanne
^
dum1.java:5: error: illegal character: \160
    public static void main(String
^
dum1.java:5: error: illegal character: \160
    public static void main(String
^
dum1.java:5: error: illegal character: \160
    public static void main(String
^
dum1.java:5: error: illegal character: \160
    public static void main(String
^
dum1.java:7: error: illegal character: \160
        // declarations
^
dum1.java:7: error: not a statement
        // declarations
^
dum1.java:7: error: illegal character: \160
        // declarations
^
dum1.java:7: error: not a statement
        // declarations
^
dum1.java:7: error: illegal character: \160
        // declarations
^
dum1.java:7: error: not a statement
        // declarations
^
dum1.java:7: error: illegal character: \160
        // declarations
^
dum1.java:7: error: not a statement
        // declarations
^
dum1.java:7: error: illegal character: \160
        // declarations
^
dum1.java:7: error: not a statement
        // declarations
^
dum1.java:7: error: illegal character: \160
        // declarations
^
dum1.java:7: error: not a statement
        // declarations
^
dum1.java:7: error: illegal character: \160
        // declarations
^
dum1.java:7: error: not a statement
        // declarations
^
dum1.java:7: error: illegal character: \160
        // declarations
^
dum1.java:7: error: not a statement
        // declarations
^
dum1.java:8: error: illegal character: \160
        int numberOfMarbles;
^
dum1.java:8: error: not a statement
        int numberOfMarbles;
^
dum1.java:8: error: illegal character: \160


.... ... .. ( repeated similar errors )

100 errors
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you did copy-paste from another site and get bunch of errors in your IDE (like I did with your code, because syntax looks fine) there probably are some special characters invisible in your IDE that you "picked" from the source (white spaces, usually).

edit: Yep, \160, lots of these special characters in your code.
 
WeiJie Lim
Ranch Hand
Posts: 92
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kemal Sokolovic wrote:If you did copy-paste from another site and get bunch of errors in your IDE (like I did with your code, because syntax looks fine) there probably are some special characters invisible in your IDE that you "picked" from the source (white spaces, usually).

edit: Yep, \160, lots of these special characters in your code.


Dang, I thought I replaced all the wrong quotation marks.. Guess there are still some special characters which I can't spot.

I wanted to test out the code from a book.. oh well.
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can either retype the code yourself, or wherever you have blanks (white space, new line, etc.) remove it and reformat your code again. The first is certainly better, since it's not a lot of code, you can do it quickly.
 
WeiJie Lim
Ranch Hand
Posts: 92
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay found those offending weird characters in UTF-8 .. Thought it was ANSI .

Thanks for the help =)
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic