速配婚姻介绍所,每次执行都有不同的结果呦!
来源:互联网 发布:网络监控摄像头安装 编辑:程序博客网 时间:2024/04/28 21:50
public class Partner{
public static void main(String[] args){
MatchMarry group1=new MatchMarry("曹操","传明");
MatchMarry group2=new MatchMarry("小六","小慧");
MatchMarry group3=new MatchMarry("小花","小二货");
MatchMarry group4=new MatchMarry("曹操","小花");
MatchMarry group5=new MatchMarry("传明","小六");
System.out.println("**速配婚姻介绍所,宗旨是要保证发扬\"执子之手 与子偕老\"的精神");
group1.start();
try{
group1.join();
}catch(InterruptedException e){
System.out.println("唤醒异常:"+e.getMessage());
}
group2.start();
try{
group2.join();
}catch(InterruptedException e){
System.out.println("唤醒异常:"+e.getMessage());
}
group3.start();
try{
group3.join();
}catch(InterruptedException e){
System.out.println("唤醒异常:"+e.getMessage());
}
group4.start();
try{
group4.join();
}catch(InterruptedException e){
System.out.println("唤醒异常:"+e.getMessage());
}
group5.start();
try{
group5.join();
}catch(InterruptedException e){
System.out.println("唤醒异常:"+e.getMessage());
}
System.out.println("速配结束...");
}
}
class MatchMarry extends Thread{
private String name;
private String otherName;
private boolean isMarry=false;
public MatchMarry(String name,String otherName){
this.name=name;
this.otherName=otherName;
}
public void run(){
try{
int person=(int)Math.floor((Math.random()*10+1));
if (person%2==0){
isMarry=true;
}
else{
isMarry=false;
}
if(!isMarry){
System.out.println(name+"可以与"+otherName+"结婚,祝福你们");
}else{
System.out.println(otherName+"已婚,红色警告:对待婚姻不要有二心");
}
Thread.sleep(200);
}catch(InterruptedException e){
System.out.println("唤醒异常:"+e.getMessage());
}
}
public static void main(String[] args){
MatchMarry group1=new MatchMarry("曹操","传明");
MatchMarry group2=new MatchMarry("小六","小慧");
MatchMarry group3=new MatchMarry("小花","小二货");
MatchMarry group4=new MatchMarry("曹操","小花");
MatchMarry group5=new MatchMarry("传明","小六");
System.out.println("**速配婚姻介绍所,宗旨是要保证发扬\"执子之手 与子偕老\"的精神");
group1.start();
try{
group1.join();
}catch(InterruptedException e){
System.out.println("唤醒异常:"+e.getMessage());
}
group2.start();
try{
group2.join();
}catch(InterruptedException e){
System.out.println("唤醒异常:"+e.getMessage());
}
group3.start();
try{
group3.join();
}catch(InterruptedException e){
System.out.println("唤醒异常:"+e.getMessage());
}
group4.start();
try{
group4.join();
}catch(InterruptedException e){
System.out.println("唤醒异常:"+e.getMessage());
}
group5.start();
try{
group5.join();
}catch(InterruptedException e){
System.out.println("唤醒异常:"+e.getMessage());
}
System.out.println("速配结束...");
}
}
class MatchMarry extends Thread{
private String name;
private String otherName;
private boolean isMarry=false;
public MatchMarry(String name,String otherName){
this.name=name;
this.otherName=otherName;
}
public void run(){
try{
int person=(int)Math.floor((Math.random()*10+1));
if (person%2==0){
isMarry=true;
}
else{
isMarry=false;
}
if(!isMarry){
System.out.println(name+"可以与"+otherName+"结婚,祝福你们");
}else{
System.out.println(otherName+"已婚,红色警告:对待婚姻不要有二心");
}
Thread.sleep(200);
}catch(InterruptedException e){
System.out.println("唤醒异常:"+e.getMessage());
}
}
}
- 速配婚姻介绍所,每次执行都有不同的结果呦!
- 看了一次又一次,每次都有不同的感受....
- AES加密算法在linux下相同输入每次加密结果都不同的问题
- golang中实现每次产生的随机数都不同
- 每次笔试每次都有错误
- 每次执行程序, rand() 都返回相同顺序的数字。
- 关于Appium执行案例每次都安装app的问题
- 让google搜索每次都出现结果
- 每次都一样,我已经知道结果!
- Bash On Windows ,每次用每次都不同
- SenchaTouch的弹出框,每次都先执行hide后在执行show的解决方案
- Unix网络编程卷一: 从服务器获取时间信息(三)-daytimetcpcli2客户端每次执行结果不同
- mysql排序字段相同每次查询出的来结果都不一样
- 用深度学习每次得到的结果都不一样,怎么办?(Python)
- 为什么RSA公钥每次加密得到的结果都不一样?
- IE8浏览器每次都有提示设置
- 如何解决 "Powered by ECShop"每次显示的位置都不同的问题
- 同一个项目接收请求的时候每次获得的session都不同
- thinking in java逍遥游记 之 夜的第三章
- 直接用LaTex生成批注效果
- ural 1297
- poj3278 优先队列
- SQL 重复与不重复记录
- 速配婚姻介绍所,每次执行都有不同的结果呦!
- 零成本的电子邮件营销
- POJ 3468 A Simple Problem with Integers
- POJ 3225 Help with Intervals
- win2003+iis6.0 Service unavailable 问题的解决方法
- 如何用电子邮件做后续营销
- 精通git中文版 (连载二)
- 输入一个数 可得到这个数的十次加如输入1 可算 1+11+111+1111.........(十次)
- 一种高效的营销模式 - 病毒式营销