---
title: "答复: 不用判断语句求俩数中的大（或者小）数"
author: "抛出异常的爱"
date: "2010-05-31T12:55:08Z"
tags: []
categories: ["非技术"]
slug: "untitled"
draft: false
lastmod: "2010-05-31T12:55:08Z"
id: 679832
url: "https://loveexception.iteye.com/blog/679832"
---

跳大神也是一种艺术:

```java
public class MaxMin {
	static int max = 0 ;
	public static void main(String[] args) throws InterruptedException {
		MaxMin m = new MaxMin();
		int a = m.max(9, 10);
		System.out.println("最大:"+a);
		
	}
	public int max(int a , int b ) throws InterruptedException{
		new MyThread(a,this).start();
		new MyThread(b,this).start();
		Thread.sleep((a+b));	
		return this.max;
	}
}

class MyThread extends Thread{
	public int f = 0;
	public MaxMin max ;
	MyThread(int f , MaxMin max){
		this.f=f;
		this.max = max;
	}
	public void run() {
		try {sleep(f);} catch (Exception e) {}
		max.max = f;
	}
}
```