import java.util.Calendar; import java.util.GregorianCalendar; import java.awt.*; import javax.swing.*; public class Ex extends JFrame{ public Ex() { super("倒计时"); setBackground(Color.WHITE); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds
表盘式时钟,并显import java.awt.*; import java.awt.event.*; import javax.swing.*; import sun.util.calendar.Gregorian; import java.util.Calendar; import java.util.GregorianCalendar; public class Clock extends JFrame implements ActionListener{ int x, y, x0, y
倒计时 public static void main (String[] args){ Frame f=new Frame(""); Calendar xmas = new GregorianCalendar();//get the date of today Calendar newyears = new GregorianCalendar(2008,Calendar.AUGUST,8); //2008.8.8 long diffMillis = newyears.getTimeInMil
带有备忘录的万年历 <% days = new String[42]; for (int i = 0; i <% GregorianCalendar currentDay = new GregorianCalendar(); int today = currentDay.get(Calendar.DAY_OF_MONTH); int month = currentDay.get(Calendar.MONTH); int year = currentDay.g
仍然是课本上的练习题。题目如下:
Y. Daniel Liang: Introduction to Java Programming 10th, p. 445
得到继承层次如图所示:
定义Person类
class Person {
String name;
String address;
String phoneNumber;
String emailAddress;
public Person() {
}
public Person