Topic: 请各位高手帮忙看看这段代码怎么了? (illegal character: \12288)

  Print this page

1.请各位高手帮忙看看这段代码怎么了? (illegal character: \12288) Copy to clipboard
Posted by: cjy
Posted on: 2004-08-31 16:09

各位高手,我才开始学java。编译这段程序时报错,但不知错在哪里?望各位能帮帮。
class employee
{
protected String name;
protected String street;
protected String city;
protected String prov;
protected String postcode;
protected int no;
employee(String pname,String pstreet,String pcity,String pprov,String ppostcode,int pno)
{
name=pname; street=pstreet;city=pcity;prov=pprov;postcode=ppostcode;no=pno;
}
void changeName(String newname)
{
name=newname;
}
public void display()
{
System.out.println("输出记录"+no);
System.out.println("  姓名"+name);
System.out.println("街道地址"+street);
System.out.println("   市"+city);
System.out.println(" 省"+prov);
System.out.println("邮政编码"+postcode);
}
}
public class TestEm{
public static void main(String args[]){
employee em1=new employee("王军","中山路120号","长沙市","湖南省","410600",1);
employee em2=new employee("段君","湖南路234号","南京市","江苏省","214000",2);
em1.display();
em2.display();
}
  }
编译时报错为:
\TestEm\TestEm.java:34: illegal character: \12288
  }
^
\TestEm\TestEm.java:34: illegal character: \12288
  }
^
TestEm\TestEm.java:34: <identifier> expected
  }
^
先谢过各位啦。

2.Re:请各位高手帮忙看看这段代码怎么了? [Re: cjy] Copy to clipboard
Posted by: xiaopa
Posted on: 2004-08-31 16:14

全角空格?把最后的“}”前面的东西都删掉

3.Re:请各位高手帮忙看看这段代码怎么了? [Re: cjy] Copy to clipboard
Posted by: forrest_gump
Posted on: 2004-08-31 16:23

楼上说得对,应该是不可见字符导致的问题,程序里有一些java不认识的字符,删掉就行。

4.Re:请各位高手帮忙看看这段代码怎么了? [Re: cjy] Copy to clipboard
Posted by: cjy
Posted on: 2004-08-31 16:45

各位真是高手啊,我试过了,真的可行。以后有问题要还来多多请教各位啊。真是多谢各位了。


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923