这是我按照书写的怎么还会有错啊? doublo d=Doublo.porscDoublo(s);应该是double d=Double.parseDouble(s); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //================Squre.java===========import javax.swing.JOptionPane;public class Squre { public static void main(String args[]) { String s=JOptionPane.showInputDialog("输入一浮点数:"); double d=Double.parseDouble(s); double dd=d*d; JOptionPane.showMessageDialog(null, s+"的平方为:"+dd, "标题:平方",JOptionPane.PLAIN_MESSAGE ); System.exit(0); } }这个程序是我调试过的,绝对没问题我建议兄弟你换本书看吧,这本书错误百出:) import javax.swing.JOptionPane;public class Squre2 { public static void main(String args[]) { String s=JOptionPane.showInputDialog("Please input a float number:"); double d=Double.parseDouble(s); double dd=d*d; JOptionPane.showMessageDialog( null, s+"µÄƽ·½Îª:"+dd, "±êÌâ:ƽ·½", JOptionPane.PLAIN_MESSAGE); System.exit(0); } } fuck,怎么中文变乱码了import javax.swing.JOptionPane;public class Test { public static void main(String args[]) { String s=JOptionPane.showInputDialog("Please input a float number:"); double d=Double.parseDouble(s); double dd=d*d; JOptionPane.showMessageDialog(null, s+"的平方为:"+dd, "标题:平方",JOptionPane.PLAIN_MESSAGE ); System.exit(0); } }建议楼主换个编辑器,很多错误都是很明显的 double是数据类型和int差不多Double是对象和Date类似仔细找找不行都注释掉一行一行调试 问下 J2SE 里static 和 final , abstract 的区别 急!GUI的问题 求一本好书? somebody help.! JRE可扩展包「再发布包」 关于inner类的问题 为什么不能获取最新的ID?? 句柄 Stateful session bean的一个小问题! [提议] 既然考scjp的人这么对,提议设立scjp专栏,响应的进来领分! 初学JAVA,书上说JAVA的字符集采用的是UNICODE的编码方式,那char类型的数据是占一个字节还是2个字节呢? 初学者问题请教,解决就结帖!
import javax.swing.JOptionPane;
public class Squre
{
public static void main(String args[])
{
String s=JOptionPane.showInputDialog("输入一浮点数:");
double d=Double.parseDouble(s);
double dd=d*d;
JOptionPane.showMessageDialog(null,
s+"的平方为:"+dd, "标题:平方",JOptionPane.PLAIN_MESSAGE );
System.exit(0);
}
}
这个程序是我调试过的,绝对没问题
我建议兄弟你换本书看吧,这本书错误百出:)
{
public static void main(String args[])
{
String s=JOptionPane.showInputDialog("Please input a float number:");
double d=Double.parseDouble(s);
double dd=d*d;
JOptionPane.showMessageDialog( null, s+"µÄƽ·½Îª:"+dd, "±êÌâ:ƽ·½", JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
}
import javax.swing.JOptionPane;public class Test
{
public static void main(String args[])
{
String s=JOptionPane.showInputDialog("Please input a float number:");
double d=Double.parseDouble(s);
double dd=d*d;
JOptionPane.showMessageDialog(null,
s+"的平方为:"+dd, "标题:平方",JOptionPane.PLAIN_MESSAGE );
System.exit(0);
}
}
建议楼主换个编辑器,很多错误都是很明显的
Double是对象和Date类似
仔细找找不行都注释掉一行一行调试