晕...最近一直考试..完全没时间弄这个..随便帮我写个小程序,再小写一个报告..比如写分析,设计,实现(关键技术和代码)..要是没时间的话,只写个分析或者关键技术代码也行啊!!各位大哥拜托了!!

解决方案 »

  1.   

    随便??噢!!文件名HelloWorld.java代码:
    public class HelloWorld
    {
        public static void(String[] args)
        {
            System.out.println("Hello World!");
         }
    }最简单的小程序报告:
        这是一个典型的JAVA程序,是几乎所有Java程序员的入门及程序,它体现了java程序结构。
      

  2.   

    不好意思 void 后还有有一个main
    达一犯了SB问题
      

  3.   

    import javax.swing.*;public class MyFrame extends JFrame
    {
        public static void main(String [] args)
        {
            MyFrame myFrame = new MyFrame();
        }
        public MyFrame()
        {
            super();
            this.setSize(200,200);
            this.setTitle("JFrame");
            this.setVisible(true);
        }
    }报告:
    这是一个典型的JAVA GUI程序。
      

  4.   

    楼上这个例子书上就有...
    我的意思是那种JAVA小程序,比如时钟啊..计算器之类的..
      

  5.   

    时钟小程序:
    import java.applet.*;
    import java.awt.*;
    import java.awt.geom.*;
    import java.util.*;
    public class Clock extends Applet implements Runnable
    {
      private double sec=0;
      private final double RADIUS=100;
      private final double SECOND_HAND_LENGTH=0.75*RADIUS;
      private final double MIN_HAND_LENGTH=0.65*RADIUS;
      private final double HOUR_HAND_LENGTH=0.5*RADIUS;
      private Thread thisThread;
      private GregorianCalendar time= new GregorianCalendar();
      
      public void init()
      {
      setSize(2*(int)RADIUS+1,2*(int)RADIUS+1);
      sec=(double)time.get(Calendar.HOUR)*60*60;
      sec+=(double)time.get(Calendar.MINUTE)*60;
      sec+=(double)time.get(Calendar.SECOND);
      if(thisThread==null)
         thisThread= new Thread(this);  
      thisThread.start();
      
      
      }  public void drawHand(Graphics2D g2,double angle, double handLength)
      {
    Point2D  end =new Point2D.Double(RADIUS+handLength*Math.cos(angle),RADIUS-handLength*Math.sin(angle));
    Point2D center= new Point2D.Double(RADIUS,RADIUS);
    g2.draw(new Line2D.Double(center,end));
      }
      
      public void drawPoint(Graphics2D g2)
      {
    int i=1;
    for(i=1;i<=60;i++)
    {
      Point2D  P1 =new Point2D.Double(RADIUS+RADIUS*0.9*Math.cos(Math.toRadians(90-360*i/60)),RADIUS-RADIUS*0.9*Math.sin(Math.toRadians(90-360*i/60)));
      if (i==5|i==10|i==15|i==20|i==25|i==30|i==35|i==40|i==45|i==50|i==55|i==60)
      {
      Point2D  P2 =new Point2D.Double(RADIUS+RADIUS*0.95*Math.cos(Math.toRadians(90-360*i/60)),RADIUS-RADIUS*0.95*Math.sin(Math.toRadians(90-360*i/60)));
      g2.setColor(Color.RED);
      g2.draw(new Line2D.Double(P1,P2));
      g2.setColor(Color.BLACK);
      }
      else   
      {
      Point2D  P2 =new Point2D.Double(RADIUS+RADIUS*0.9*Math.cos(Math.toRadians(90-360*i/60)),RADIUS-RADIUS*0.9*Math.sin(Math.toRadians(90-360*i/60)));
      g2.draw(new Line2D.Double(P1,P2));
      }
      
    }
      }
     
      public void paint(Graphics g)
      {
      
      Graphics2D g2=(Graphics2D)g;
      Ellipse2D circle=new Ellipse2D.Double(0,0,2*RADIUS,2*RADIUS);
      g2.draw(circle);
      double hourAngle=Math.toRadians(90-360*sec/(12*60*60));
      drawHand(g2,hourAngle,HOUR_HAND_LENGTH);
      double minAngle=Math.toRadians(90-360*sec/(60*60));
      drawHand(g2,minAngle,MIN_HAND_LENGTH);
      double secAngle=Math.toRadians(90-360*sec/60);
      drawHand(g2,secAngle,SECOND_HAND_LENGTH);
      drawPoint(g2);
      }
      
      public void setTimer()
      {
        sec+=1;
      }
      
      public void run()
      {
     while(thisThread!=null)
     {
     try{
     thisThread.sleep(1000);
    }
     catch(InterruptedException e)
     {
     break;
     }
     setTimer();
       repaint();

     }
      }
      
      public void stop()
      {
     thisThread=null;  
      }  
      }
      

  6.   

    public class HelloWorld 
    {  static {
    System.out.println("HelloWorld");
    }
    } 这个  HelloWorld  怎么样??
      

  7.   

    在那本《JAVA2核心技术:基础知识》上有很多经典例子啦。
      

  8.   

    写个学生信息管理系统啊。
    我写了一半。纯手写,用JC,,,,
    郁闷,老师要求的。不过够锻炼人的。JBX要方便。至少在GUI那块可以速度点。
      

  9.   

    good good study,day day up