class DialogTest
{
public static void main(String[] args)
{
String str = JOptionPane.showDialog("请输入您的姓名:");
System.out.println(str);
System.exit(0);
}
}
以上程序编好后保存为:DialogTest.java编译后有错误
我是按照书上说的编写的。
我是初学者,我觉得问题很简单,望有朋友能帮忙解决!解决后马上给分100!!!
{
public static void main(String[] args)
{
String str = JOptionPane.showDialog("请输入您的姓名:");
System.out.println(str);
System.exit(0);
}
}
以上程序编好后保存为:DialogTest.java编译后有错误
我是按照书上说的编写的。
我是初学者,我觉得问题很简单,望有朋友能帮忙解决!解决后马上给分100!!!
解决方案 »
- 一个简单的正则表达式求解
- 五子棋算法
- 关于java编译:只修改class A并重新编译A,与A关联的其他class不重新编译有没有影响?
- 请教一个Applet问题,平时接触的少不会做这方面的东东
- 请各位帮忙看看错误在哪里
- 高分求解:怎么才能使我的程序离开JBuilder的运行环境?
- 集合,先按照value数量排序,再按照value值大小排序...求解!!
- 为什么jbuilder的帮助里面有这个类,却引入不了?
- 菜鸟问题,请帮忙!
- 如何设置tomcat,改变我的.class文件的默认路径。
- 怎么改变数组长度而保留已有元素值?
- 100分求代码!从文本文件中按照时间间隔(不定长)一行行读出,并在TextArea中依次显示出来(注:功能像迷你歌词一样)
要不要import什么的?错误信息是什么?
DialogTest.java:5:cannot resolve symbol
symbol : variable JOptionPane
location: class DialogTest
String str = JOptionPane.showDialog("请输入您的姓名:");
^
1 error
用showInputDialogString str = JOptionPane.showInputDialog("请输入您的姓名:");
语法:
showInputDialog
public static String showInputDialog(Component parentComponent,
Object message,
Object initialSelectionValue)Shows a question-message dialog requesting input from the user and
parented to parentComponent. The input value will be
initialized to initialSelectionValue.
The dialog is displayed on top of the Component's
frame, and is usually positioned below the Component.Parameters:parentComponent - the parent Component for the
dialogmessage - the Object to displayinitialSelectionValue - the value used to initialize the input
field
class DialogTest
{
public static void main(String[] args)
{
String str = JOptionPane.showInputDialog("请输入您的姓名:");
System.out.println(str);
System.exit(0);
}
}
好了 谢谢 马上100分