一个关于接口的问题

ahj 2003-09-29 09:09:17









我的Student_info.java文件如下
interface Student_info
{
int year =2002;
int age();
void output();
}

我的Stu1.java如下
public class Stu1 implements Student_info
{
String name;
int birth_year;
public Stu1(String n1,int y)
{
name=n1;
birth_year=y;
}
public int age()

{
return year-birth_year;
}
public void output()
{System.out.println(this.name+" "+this.age()+"岁");
}
public static void main(String arg[])
{
Stu1 s1=new Stu1("李明",1980);
s1.output();
}
}
但是有错误
D:\my java>javac Stu1.java
Stu1.java:16: illegal character: \65307
{System.out.println(this.name+" "+this.age()+"岁");
请问这是为什么????????? 谢谢


...全文
23 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
ahj 2003-09-30
  • 打赏
  • 举报
回复
谢谢
小弟在问一下好的编辑器从那下啊
在次谢谢
honkyjiang 2003-09-30
  • 打赏
  • 举报
回复
hehe 这种问题可难查啊 !!
highreport 2003-09-30
  • 打赏
  • 举报
回复
jcreate pro2.5
wangsheng1028 2003-09-30
  • 打赏
  • 举报
回复
{System.out.println(this.name+" "+this.age()+"岁");}
上面好像出现了全角的分号哦

wwwhyf 2003-09-30
  • 打赏
  • 举报
回复
这个问题可能是由于println()中要输出汉字要做些设定
因为输出英文和汉字所用的编码集是不同的
你要设定先,具体的找书吧
sunshine5246 2003-09-29
  • 打赏
  • 举报
回复
分号应该改为英文下的。象楼上说的最好装个好点的软件。可以达到事半功倍的效果。
swinging 2003-09-29
  • 打赏
  • 举报
回复
弄个好点的编辑器吧。eclipse,
等等,都可以帮助你减少不必要的错误。
zcjl 2003-09-29
  • 打赏
  • 举报
回复
System.out.println(this.name+" "+this.age()+"岁");
最后面的分号是中文符号,应改为英文下的;

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧