Eclipse Test and Performance Tools Platform简介 - 编程入门网
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-06-18
static final int CAPSULE = 2 * MINUTE;
static final int BOOSTER = 5 * MINUTE;
static final int STAGE = 3 * MINUTE;
static final int MONKEY = 10 * MINUTE;
class Capsule {
public Monkey chimp1 = new Monkey(), chimp2 = new Monkey();
public Capsule() {
System.out.println("Start building the capsule...");
_killTime(CAPSULE);
chimp1.build();
chimp2.build();
System.out.println("Capsule complete.");
}
}
class Booster {
public Booster() {
System.out.println("Start booster...");
_killTime(BOOSTER);
System.out.println("Blast off.");
}
}
class Stage {
public Stage() {
System.out.println("start stage...");
_killTime(STAGE);
System.out.println("Stage complete.");
}
}
class Monkey {
public void start() {
System.out.println("Start the monkey business...");
}
public void build() {
start();
_killTime(MONKEY);
finish();
}
public void finish() {
System.out.println("Monkey business complete.");
}
}
public static void main(String[] args) throws java.io.IOException
{
final int NUMBERTOYS = 9;
BufferedReader in = new
BufferedReader(new InputStreamReader(System.in));
SpaceShipToy[] toys = new SpaceShipToy[NUMBERTOYS];
String input = in.readLine().trim();
System.out.println("Toy factory is up and running...");
System.out.flush();
for (int i = 0; i < NUMBERTOYS; i++)
toys[i] = null;
while (!input.equalsIgnoreCase("q")) {
if (input == null || input.length() != 1
|| !Character.isDigit(input.charAt(0))) {
System.err.println ("Unknown option. Try 0-9, q");
input = in.readLine().trim();
continue;
}
int number = Integer.valueOf(input).intValue();
if (number == 9) {
new SpaceShipToy();
System.out.println("Whoops... Lost one...");
}
else {
if (toys[number] != null) {
System.out.println("Shipping toy # " + number);
toys[number] = null;
}
else {
System.out.println("Building toy # " + number);
toys[number] = new SpaceShipToy();
}
}
input = in.readLine().trim();
}
}
}
Eclipse Test and Performance Tools Platform简介(6)时间:2011-02-25 IBM Martin Streicher这个 Java 应用程序很简单:它 “构建” 玩具飞船并 |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于Eclipse Test and Performance Tools Platform简介 - 编程入门网的所有评论