|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
发信人: KHP (人之初), 信区: Java
标 题: Re: help!
发信站: BBS 水木清华站 (Sat May 29 01:57:19 1999)
如果这是一个文件当然不行了,每个文件中只能有一个 public 类,
import 在所有类定义之前
【 在 xianfeng (风云) 的大作中提到: 】
: 我是一个java的初学者下面的程序编译时出错
: 小弟不得其解 望各位仁兄相助
: **为出错处和其提示
- : //Testcomp.java
- : //define a class of complex
- : public class Complex1 **”Complex1" with a red line
- : {
- : private float real; //the real part of the Complex
- : private float imag; //the imaginary part of the Complex
- : :
- : :
- : public String toString()
- : {
- : return ( "(" + real + "," + imag + ")" );
- : }
- : }
- : //test the function of the class 'Complex1'
- : //import Complex1;
- : import java.awt.Graphics; **"import with a red line "
- : **error "Expected 'class','interface',or 'delegate'(j0256)"
- :
- : import java.applet.Applet;
- : public class Testcomp extends Applet
- : {
- : private Complex1 com1 = new Complex1(3, 5 );
- : private Complex1 com2 = new Complex1(2, 4 );
- : :
- : :
- : }
复制代码 |
|