javaʵÏÖµÄÑ¡ÔñÅÅÐò
ÏÂÃæÊÇÓÃjavaʵÏÖµÄÑ¡ÔñÅÅÐò£¬Ã¿´Î´ÓÊý×éÖÐÑ¡È¡×îСµÄÖµ£º
import java.util.Date;
import java.util.Random;
/*
* Ñ¡ÔñÅÅÐò
*/
public class SelectSort {
public static void main(String args[])
{
int len = 40;
Date date = new Date();
Random random = new Random(date.getSeconds());
int data[]=new int[len];
for(int i = 0; i < len; i++)
{
data[i]=(int)(random.nextFloat()*100+1);
}
System.out.println("Select sort:");
show(data);
selectSort(data);
show(data);
}
private static void selectSort(int[] data)
{
int length = data.length;
for(int i=0; i<length-1; i++)
{
int temp = data[i];
for(int j=i+1; j<length; j++)
{
if(data[j] < temp )
{
data[i] = data[j];
data[j] = temp;
temp = data[i];
}
}
data[i]=temp;
}
}
private static void show(int[] data)
{
System.out.println("========================");
for(int i = 0; i < data.length; i++)
{
System.out.print(data[i] + " ");
}
System.out.println();
System.out.println("========================");
}
}
Ïà¹ØÎĵµ£º
ÏÂÃ濪½²¹ÊÊ£º
´ÓÇ°Óиö·¿¼ä£¬·¿¼äÀïÓзÝÎĵµ£¬·¿¼ä»¹ÓÐÒ»°ÑÔ¿³×¡£ Õâ°ÑÔ¿³×ÔÚÕÅÈýÊÖÀï¡£
ÕâʱÀîËÄÀ´ÏòÕÅÈýÒªÄÇ·ÝÎĵµ¡£ ÕÅÈý²»Ì«Ï²»¶ÀîËÄ£¬µ«ÓÖŵ¢ÎóÁË
¹¤×÷²»ºÃ½»´ú¡£ÓÚÊÇÕÅÈý¾Í°Ñ·¿¼äÀïÎĵµµÄÎĵµ¸´Ó¡ÁËÒ»·Ý£¬È»ºó°ÑÄǸö¸´Ó¡¼þ½»¸øÁËÀîËÄ£¨Õâ½Ð´«Öµ£©¡£
ÀîËÄÄõ½Îĵµºó£¨¸´Ó¡¼þ£©£¬ºúÂÒÐÞ¸ÄÒ» ......
package thread;
class TestThread extends Thread {
public void run(){
while(true){
System.out.println(Thread.currentThread().getName());
}
}
}
public class ThreadDemo {
/**
* @param args
*/
public static void ......
ÔÚÓ¦Óÿª·¢ÖУ¬¾³£ÐèҪһЩÖÜÆÚÐԵIJÙ×÷£¬±ÈÈçÿ5·ÖÖÓÖ´ÐÐijһ²Ù×÷µÈ¡£ÔÚWEBÏîÄ¿ÖпÉÄÜÐèҪÿ¸ôÒ»¶Îʱ¼ä×Ô¶¯Éú³É¾²Ì¬Ò³£¬×Ô¶¯¼ì²âÊÇ·ñÓÐÐÂÓʼþ£¬¶¨Ê±×Ô¶¯±¸·ÝÎļþµÈ²Ù×÷¡£ÕâЩ¶¼¿ÉÒÔͨ¹ý¶¨Ê±Æ÷TimerÀ´½â¾ö¡£
ÕâÀï½öÌṩ¶¨Ê±Æ÷µÄ²¿·Ö·½·¨ºÍ˵Ã÷£¬¾²Ì¬Ò³Éú³ÉµÈ²Ù×÷¶ÁÕß¿ÉÒÔͨ¹ýÏà¹Ø·½·¨×ÔÐнâ¾ö¡£
¡£¡£¡£°Ù¶È¿Õ¼äÌù´úÂë×ÜÊ ......
package thread;
class QQ{
private String name;
private String sex;
boolean flag=false;
public synchronized void put(String name,String sex){
if(flag)
try {
wait();
} catch (InterruptedException e ......
1¡¢²»¿ÉÒÔÓÃÒ»¸ö±¾µØÀàÐÍ£¨Èçint float£©À´Ìæ»»·ºÐÍ
2¡¢ÔËÐÐʱÀàÐͼì²é£¬²»Í¬ÀàÐ͵ķºÐÍÀàÊǵȼ۵ģ¨Pair<String>ÓëPair<Employee>ÊÇÊôÓÚͬһ¸öÀàÐÍPair£©£¬
ÕâÒ»µãÒªÌرð×¢Ò⣬¼´Èç¹ûa instanceof Pair<String>==trueµÄ»°£¬²¢²»´ú±ía.getFirst()µÄ·µ»ØÖµÊÇÒ»¸öS ......