放在同一个目录里
然后
import PackageName.SuperClass;
或
import PackageName.*;
然后
import PackageName.SuperClass;
或
import PackageName.*;
解决方案 »
- oracle中生僻字显示正常,到用程序写到xml中却是问号,求解答
- 求教~!java编译出现调用未经检查错误。
- java的图形用户界面用得多吗
- 一个castor转换难题啊。有人帮我一下吗?
- 请教--汉字编码!
- ItemUnitList cannot be resolved to a type怎么解决了!请大牛指点!!
- Applet!大家帮我读各文件[在线等。。。]
- 请问,MultipartRequest怎么用啊!
- java学习中的一点疑问,请各位帮忙谢谢
- 学JAVA,看毕老师的视频,是一边敲一边看?还是看完在敲呢?
- 为什么我在win98的的dos下运行程序老出现这个(学java的第三天)
- 刚刚学习java,不知道从哪里下手,请推荐好书,经验!
class SuperClass
{
...
}
//ThisClass.java
class ThisClass extends SuperClass
{
...
}
两者在同一目录。本来方法很多,但你问了这个问题,说明你现在对她不是很了解,用这种就行了,其他的以后你自然就知道了。
classpath是设置你的程序想使用的其他类的路径的,比如我显示用D:\A.java
在原classpath=...后加,对:D:\既可。只是一种DOS的环境设置。///////////////////////以下是java的文档介绍的////////////////////
The class path can be set using either the -classpath option when calling an SDK tool (the preferred method) or by setting the CLASSPATH environment variable. The -classpath option is preferred because you can set it individually for each application without affecting other applications and without other applications modifying its value.
C:> sdkTool -classpath path1;path2... -or- C:> set CLASSPATH=path1;path2... where: sdkTool
A command-line tool, such as java, javac, or javadoc. For a listing, see SDK Tools. path1;path2
Paths to the .jar, .zip or .class files. Each path should end with a filename or directory depending on what you are setting the class path to:
For a .jar or .zip file that contains .class files, the path ends with the name of the .zip or .jar file.
For .class files in an unnamed package, the path ends with the directory that contains the .class files.
For .class files in a named package, the path ends with the directory that contains the "root" package (the first package in the full package name).
Multiple path entries are separated by semi-colons. With the set command, it's important to omit spaces from around the equals sign (=). The default class path is the current directory. Setting the CLASSPATH variable or using the -classpath command-line option overrides that default, so if you want to include the current directory in the search path, you must include "." in the new settings. Classpath entries that are not either a directory or an archive (.zip or .jar file) are ignored.