2013年9月28日星期六

Why this program can not succeed ah

import java.applet. *;
import java.awt. *;
import java.awt.event. *;
public class leapyear extends Applet implements ActionListener
{
Label result;
TextField inl;
Button btn;
int year;
boolean leap;
public void init ()
{
result = new Label (" Please enter the number to determine the year " ) ;
inl = new TextField (5);
add (inl);
add (btn);
add (result);
btn.addActionListener (this);
}
public void actionPerformed (ActionEvent e)
{
year = Integer.parseInt (inl.getText ());
if (year% 4! = 0)
leap = false;
else if (year% 100! = 0)
leap = true;
else if (year% 400! = 0)
leap = false;
else
leap = true;
if (leap == true)
result.setText (year + " is a leap year " ) ;
else
result.setText (year + " not a leap year " ) ;
inl.setText ("");
}
}

------ Solution ------------------------------------ --------
understand java -based Friends of the roof to help
estimate is junk code
------ Solution - -------------------------------------------
class name initials why is lowercase ?


------ Solution ------------------------------------ --------
In addition, this program where you are unsuccessful up ?
------ Solution ---------------------------------------- ----
said no public static void main (String arg []) can not run the main method . . . .  

public static void main ( String [] args )
------ For reference only -------- -------------------------------
white excited. . . I thought I solved it
------ For reference only -------------------------------- -------
said no public static void main (String arg []) can not run the main method . . . .
------ For reference only -------------------------------------- -
I tried . . . I still ah
------ For reference only ----------------------------------- ----
said no public static void main (String arg []) can not run the main method . . . .
------ For reference only -------------------------------------- -
to a main method .

没有评论:

发表评论