ExRandom.java
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:1k
源码类别:

J2ME

开发平台:

Java

  1. package exframework;
  2. /**
  3.  * <p>Title: ExFramework</p>
  4.  *
  5.  * <p>Description: lizhenpeng</p>
  6.  *
  7.  * <p>Copyright: Copyright (c) 2005</p>
  8.  *
  9.  * <p>Company: LP&P</p>
  10.  *
  11.  * @author lipeng
  12.  * @version 1.0
  13.  */
  14. import java.util.Random;
  15. public class ExRandom implements AllAction
  16. {
  17.   public void allAction(MainForm form)
  18.   {
  19.     Random rand = new Random();
  20.     Position pos1 = new Position();
  21.     pos1.x = rand.nextInt(100);
  22.     pos1.y = rand.nextInt(200);
  23.     System.out.println("("+pos1.x+","+pos1.y+")");
  24.     Position pos2 = new Position();
  25.     pos2.x = rand.nextInt(100);
  26.     pos2.y = rand.nextInt(200);
  27.     System.out.println("("+pos2.x+","+pos2.y+")");
  28.   }
  29. }
  30. class Position
  31. {
  32.   public int x;
  33.   public int y;
  34. }