判断闰年? 从键盘输入一个年份,判断是不是闰年.大虾帮忙写写这个程序啊! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 import javax.swing.*;import java.awt.Graphics;public class yearJudge extends JApplet{ String year; int y; String judge; public void init(){ year = JOptionPane.showInputDialog("Enter the year please!"); y = java.lang.Integer.parseInt(year); if (y % 4==0) { judge = "Yes";} } public void paint (Graphics g){ g.drawLine(15,10,210,10); g.drawLine(15,30,210,30); g.drawString(judge,25,25); } } 应该这样判断吧:if( ( (y%4==0)&&(y%100!=0) ) ||(y%400==0) ) judge="Yes"; public class Year{ public boolean isLeapYear(int value) { boolean result = false; if((value%4 == 0 && value%100 != 0) || value%400 == 0) result = true; return result; }} public static boolean isLeapYear(int nYear) { boolean bRet = false; if (0 == (nYear % 100)) { if (0 == (nYear % 400)) { bRet = true; } } else { if (0 == (nYear % 4)) { bRet = true; } } return bRet; } 菜鸟~终于写完了扫雷…请大家狠批 问个简单问题啊 异常a different object with the same identifier value was already associated with Socket 通信问题 关于线程????? 菜鸟提问 请问如何卸载jdk? 鼠标拖动 classpath里的.;到底有什么用?能解释解释吗? 怎么样设置JTable中的字体和表头的字体?(在线等待)!!!!!!!!!!!!!!!!!!!!!!!!!!!! 帮我看看这个问题怎么解决,单步执行和普通执行程序结果不同~郁闷 如果一个日期字符串"2005-06-09"如何传化成Date类型
import java.awt.Graphics;public class yearJudge extends JApplet{
String year;
int y;
String judge;
public void init(){
year = JOptionPane.showInputDialog("Enter the year please!");
y = java.lang.Integer.parseInt(year);
if (y % 4==0) {
judge = "Yes";}
}
public void paint (Graphics g){
g.drawLine(15,10,210,10);
g.drawLine(15,30,210,30);
g.drawString(judge,25,25);
}
}
if(
( (y%4==0)&&(y%100!=0) )
||(y%400==0)
)
judge="Yes";
{
public boolean isLeapYear(int value)
{
boolean result = false;
if((value%4 == 0 && value%100 != 0) || value%400 == 0)
result = true;
return result;
}
}
{
boolean bRet = false;
if (0 == (nYear % 100))
{
if (0 == (nYear % 400))
{
bRet = true;
}
}
else
{
if (0 == (nYear % 4))
{
bRet = true;
}
}
return bRet;
}