java 非法字符错误:'\u200b'
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35657620/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Illegal Character error: '\u200b'
提问by Leopold Stoich
I'm making an Asteroid Field for an Asteroid Game in my Object Oriented Programming class and I am receiving an illegal character error: '\u200b'. The issue seems to be happening on line 12. (The line between import java.awt.Point; and public class Asteroid extends PolyBlob)
我正在我的面向对象编程课程中为小行星游戏制作小行星场,但我收到一个非法字符错误:'\u200b'。问题似乎发生在第 12 行。( import java.awt.Point; 和 public class Asteroid extends PolyBlob 之间的线)
/*
* University of Central Florida
* COP3330 - Spring 2016
* Author: Aundray Ortiz
*/
package asteroidfield;
import java.util.Random;
import blobzx.PolyBlob;
import blobzx.BlobUtils;
import java.awt.Point;
?
public class Asteroid extends PolyBlob
{
private static final Random random = new Random();
public Asteroid(int a, int b, double c)
{
super(-100,-100,c);
int sides = 5 + random.nextInt(5);
int[] x = new int[sides];
int[] y = new int[sides];
int going = 0;
double direct = 0;
double region = (Math.PI * 2)/sides;
for(int num = 0; num<sides;num++)
{
going = 5 + random.nextInt(16);
direct = (num * region) + (Math.random() * region);
Point p = BlobUtils.rotatePoint(going, direct);
x[num] = p.x;
y[num] = p.y;
}
setPolygon(x, y);
setRate(c);
setDelta(a,b);
}
}
回答by Jim Garrison
\u200b
is a "zero-width-space" in Unicode.
\u200b
是 Unicode 中的“零宽度空间”。
You should delete line 12 (the blank line), save the file, re-add the blank line and save again. using a simple text editor.
您应该删除第 12 行(空白行),保存文件,重新添加空白行并再次保存。使用简单的文本编辑器。
If that doesn't fix it delete lines 11 and 13 as well and recreate them.
如果这不能解决它,请删除第 11 行和第 13 行并重新创建它们。
回答by T04435
I think the point here is to not retype the copied code. So with that in mind:
我认为这里的重点是不要重新输入复制的代码。所以考虑到这一点:
Steps:
脚步:
1- Ctrl + rReplace (tick Regex checkbox)
1-Ctrl + r替换(勾选正则表达式复选框)
2- paste the character code: \u200b
2- 粘贴字符代码:\u200b
3- replace all with nothing
3-全部替换为空
Done!
完毕!