问题
Program
public class Project_X
{
public static void main(String[] args){
byte x;
int a=270;
double b =128.128;
System.out.println("int converted to byte");
x=(byte) a;
System.out.println("a and x "+ a +" "+x);
System.out.println("double converted to int");
a=(int) b;
System.out.println("b and a "+ b +" "+a);
System.out.println("n double converted to byte");
x=(byte) b;
System.out.println("b and x "+b +" "+x);
}
}
error get
illegal character:\160
回答1:
You copy-pasted the program code using a tool (probably a web browser) that includes "funky" symbols in copied text. E.g. the non-breaking space.
One way to expose these characters is the following:
- Go to http://www.asciitohex.com/
- Copy-paste your code into the input box
- Click on convert
- Copy paste text from "Html Entities" output on lower right corner
- Remove all -s and other strange things from code
回答2:
\u160
is the non-breaking space. Have you tried deleting and retyping the line?
来源:https://stackoverflow.com/questions/17626909/illegal-character-with-blue-j