2016-02-26 203 views
5

我在面向對象編程類中爲小行星遊戲製作了一個Asteroid字段,並收到非法字符錯誤:'\ u200b'。這個問題似乎是對線12發生(進口java.awt.Point中之間的線;以及公共類小行星延伸PolyBlob)非法字符錯誤:' u200b'

/* 
* 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); 
    } 
} 

回答

12

\u200b是一個「零寬度空間」以Unicode。

您應該刪除第12行(空白行),保存文件,重新添加空白行並再次保存。使用簡單的文本編輯器。

如果這樣不能解決問題,那麼刪除第11行和第13行並重新創建它們。

+0

哇,這很容易,*臉掌* 非常感謝! –