Topic: 不知道是什么原因错了(BaseClass ; 的分号有错误)

  Print this page

1.不知道是什么原因错了(BaseClass ; 的分号有错误) Copy to clipboard
Posted by: jasonwing27
Posted on: 2004-10-26 14:03

{ 请尽量用准确的文字描述作为标题 }

//BaseClass.java
public class BaseClass {
public int x = 10 ;

}

class SubClass extends BaseClass {
void m1 () {
x = 20 ;
}
}

//UsageClass.java
import BaseClass;
public class UsageClass{
public static void main(String argv[]){
BaseClass b = new BaseClass();
System.out.println("x:"+b.x) ;
}
}
总是提示BaseClass ; 的分号有错误

2.Re:不知道是什么原因错了 [Re: jasonwing27] Copy to clipboard
Posted by: qingbo777
Posted on: 2004-10-26 17:59

import BaseClass;这是什么用法???

3.Re:不知道是什么原因错了(BaseClass ; 的分号有错误) [Re: jasonwing27] Copy to clipboard
Posted by: why
Posted on: 2004-10-27 21:55

That's incorrect use of the import statement.
Take away import BaseClass; and put the classes (.java files) in the same folder should work -- i.e. using the "default package".


   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