aspose file tools*
The moose likes Beginning Java and the fly likes Why can't it compile ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Why can Watch "Why can New topic
Author

Why can't it compile ?

WeiJie Lim
Ranch Hand

Joined: Sep 05, 2012
Posts: 85
Why can't the following code be compiled ? Any help is appreciated, thanks =)

Stuart A. Burkett
Ranch Hand

Joined: May 30, 2012
Posts: 679
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

Joined: Sep 05, 2012
Posts: 85
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

Joined: Jun 19, 2010
Posts: 825
    
    5

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.


The quieter you are, the more you are able to hear.
WeiJie Lim
Ranch Hand

Joined: Sep 05, 2012
Posts: 85
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

Joined: Jun 19, 2010
Posts: 825
    
    5

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

Joined: Sep 05, 2012
Posts: 85
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
 
subject: Why can't it compile ?