Illegal character with Blue J

纵饮孤独 提交于 2020-01-05 05:42:04

问题


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:

  1. Go to http://www.asciitohex.com/
  2. Copy-paste your code into the input box
  3. Click on convert
  4. Copy paste text from "Html Entities" output on lower right corner
  5. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!