import java.awt.*;
class Test
{
static Frame obj;
Panel p;
Button b1;
void init()
{
obj=new Frame("Hello");
p=new Panel();
Button b1=new Button("Click Me");
p.add(b1);
obj.add(p);
}
public static void main(String []args)
{
obj=Frame("Hello");//cannot resolve symbol method Frame(java.lang.String)
Test testobj=new Test();
Testobj.init();//cannot resolve symbol variable Testobj
obj.setBackground(Color.blue);
obj.setSize(300,200);
obj.setVisible(true);
}
}
----------------解决方案--------------------------------------------------------
写程序怎么能马虎大意呢,而且你写得很不规范,修改如下:
Test testobj=new Test();
Testobj.init();//cannot resolve symbol variable Testobj
// 应该是 testobj
obj=Frame("Hello");//cannot resolve symbol method Frame(java.lang.String) // 这句话不对,你自己再检查
[此贴子已经被作者于2006-1-17 19:40:51编辑过]
----------------解决方案--------------------------------------------------------
嘿嘿,obj=Frame("Hello");应该是obj=new Frame("Hello");
----------------解决方案--------------------------------------------------------