import java.awt.Graphics;import java.applet.Applet;import java.util.Calendar;class Time{private Calendar t;private int y,m,d,hh,mm,ss;Time(){t=Calendar.getInstance();y=t.get(t.YEAR);m=t.get(t.MONTH)+1;d=t.get(t.DATE);hh=t.get(t.HOUR_OF_DAY);mm=t.get(t.MINUTE);ss=t.get(t.SECOND);}public String getDate(){return y+"年"+m+"月"+d+"日";}public String getTime(){String s=hh+"小时"+mm+"分钟"+ss+"秒";return s;}}public class ShowTime extends Applet{Time t=new Time();public void paint(Graphics g){g.drawString("当前日期是:"+t.getDate(),40,40);g.drawString("当前时间是:"+t.getTime(),40,80);}}