java新手问题。
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class helloworld extends JFrame
{
public helloworld(String titleText)
{
super(titleText);
addWindowListener(new WindowAdapter()
{
public void
windowClosing(WindowEvent e)
{
helloworld.this.dispose();
System.exit(0);
}
});
JLabel greeting = new JLabel("hello world!",JLabel.CENTER);
getContentPane().add(greeting,BorderLayout.CENTER);
setSize(300,100);
setVisible =(true);
}
public static void main(String[] args)
{
new helloworld("hello world!sample");
}
}
提示错误helloworld.java:21: cannot resolve symbol
symbol : variable setVisible
location: class helloworld
setVisible =(true);
^
1 error
参考答案:setVisible(true);