| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1974 人关注过本帖
标题:请 各位大哥帮帮~ import javax.swing.JOptionPane 求闰年
只看楼主 加入收藏
dingningvol
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-4-26
收藏
 问题点数:0 回复次数:6 
请 各位大哥帮帮~ import javax.swing.JOptionPane 求闰年
//InputDialogDemo.java:Entering input from input dialog boxes
import javax.swing.JOptionPane;
public class InputDialogDemo
{
//*Main method*/
public staitc void main(String args[])
{
//Prompt the user to enter a year
String yearString = JOptionPane.showInputDialog(null,
"Enter a year","Example 2.2 Input(int)",
JOptionPane.QUESTION_MESSAGE);

//Convert the string into an int value
int year = Integer.parseInt(yearString);

//Check if the year is leap year
boolen isLeapYear =
((year%4==0)&&(year%100!=0))||(year%400==0);

//Display the result in a message dialog box
JOptionPane.showMessageDialog(null,
year + "is a leap year?" + isleapyear,
"Example 2.2 Output (int)",JOptinPane.INFORMATION_MESSAGE);

//Prompt the user to enter a double value
String doubleString = JOptionPane.showInputDialog(null,
"Enter a double value", "Example 2.2 Input (double)",
JoptionPane.QUESTION_MESSAGE);
//Convert the string into a double value
double doubleValue = Double.parseDouble(doubleString);


//Cheak if the number is positive
JOptionPane.showMessageDialog(null,
doubleValue + "is positive?" +(doubleValue>0),
"Example 2.2 Output (double)",
JOptionPane.INFORMATION_MESSAGE);


System.exit(0);
}
}

可是错误报告中的解释
图片附件: 游客没有浏览图片的权限,请 登录注册

请高手帮我下 谢谢
搜索更多相关主题的帖子: import JOptionPane javax swing 闰年 
2007-04-26 20:34
午夜屠猪男
Rank: 4
等 级:业余侠客
威 望:2
帖 子:194
专家分:259
注 册:2007-1-3
收藏
得分:0 
伙计.么把注释搞英文啊.看不懂英语啊

2007-04-26 22:19
千里冰封
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:灌水之王
等 级:版主
威 望:155
帖 子:28477
专家分:59
注 册:2006-2-26
收藏
得分:0 
public staitc void main(String args[])

应该是static

可惜不是你,陪我到最后
2007-04-27 08:57
dingningvol
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-4-26
收藏
得分:0 
回复:(dingningvol)请 各位大哥帮帮~ import javax...
多谢 我肯定是眼花了 这么明显~~
2007-04-27 12:27
tblovecj
Rank: 1
等 级:新手上路
帖 子:181
专家分:0
注 册:2006-9-20
收藏
得分:0 
这么强啊,注译都弄成英文!

2007-04-30 02:55
tblovecj
Rank: 1
等 级:新手上路
帖 子:181
专家分:0
注 册:2006-9-20
收藏
得分:0 
你那个命令提示符里报错不是都写着报错的位置吗?

2007-04-30 02:56
蹦蹦鱼吐泡泡
Rank: 1
来 自:甘肃兰州
等 级:新手上路
帖 子:1
专家分:0
注 册:2014-3-18
收藏
得分:0 
代码是正确的,就是里面的大小写的问题:
修改过就对了,你可以看哈!
import javax.swing.JOptionPane;
public class InputDialogDemo
{
//*Main method*/
   public static void main(String args[])
    {
//Prompt the user to enter a year
String yearString = JOptionPane.showInputDialog(null,"Enter a year","Example 2.2 Input(int)",JOptionPane.QUESTION_MESSAGE);

//Convert the string into an int value
int year = Integer.parseInt(yearString);

//Check if the year is leap year
boolean isLeapYear=((year%4==0)&&(year%100!=0))||(year%400==0);

//Display the result in a message dialog box
JOptionPane.showMessageDialog(null,year + "is a leap year?" + isLeapYear,"Example 2.2 Output (int)",JOptionPane.INFORMATION_MESSAGE);

//Prompt the user to enter a double value
String doubleString = JOptionPane.showInputDialog(null,"Enter a double value", "Example 2.2 Input (double)",JOptionPane.QUESTION_MESSAGE);
//Convert the string into a double value
double doubleValue = Double.parseDouble(doubleString);


//Cheak if the number is positive
JOptionPane.showMessageDialog(null,doubleValue + "is positive?" +(doubleValue>0),"Example 2.2 Output (double)",JOptionPane.INFORMATION_MESSAGE);


System.exit(0);
}
}
2014-03-18 21:38
快速回复:请 各位大哥帮帮~ import javax.swing.JOptionPane 求闰年
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020014 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved