JAVAÏß³ÌÖ®Ò»£ºÊµÏÖÒ»¸öÏ̵߳ÄÁ½ÖÖ·½·¨
Javaͨ¹ýjava.lang.ThreadÀàÍê³É¶àÏ̡߳£ÎÒÃÇͨ¹ýͬһ¸öÀý×Ó£¬¿´Ï̵߳ÄÁ½ÖÖ´´½¨·½·¨£¬ÒÔ¼°ÔËÐз½·¨£º
(1)Ò»ÖÖÊÇÉùÃ÷ Thread µÄ×ÓÀ࣬ÖØÔØ Thread ÀàµÄ·½·¨ run£¨Extend java.lang.Thread and override the run method£©
public class MyThread extends Thread
{
public void run()
{//ÒòΪȱʡµÄrun()·½·¨Ê²Ã´¶¼²»×ö£¬Äã±ØÐëÖØÔØrun()ÒÔÍê³ÉÓÐÓõŤ×÷¡£
for (int count = 1, row = 1; row < 20; row++, count++)
{
for (int i = 0; i < count; i++)
System.out.print('*');
System.out.print('\n');
}
}
}
public static void main(String[] args)
{
MyThread mt = new MyThread();//A·½·¨Ö´ÐÐ
mt.start();//A
Thread myThread = new Thread(new MyThread());//B·½·¨Ö´ÐÐ
myThread.start();//B
for (int i = 0; i < 500; i++)
{
System.out.println(i);
}
}
(2)ÁíÒ»ÖÖ;¾¶ÊÇÉùÃ÷Ò»¸öÀ࣬¸ÃÀàʵÏÖ Runnable ½Ó¿Ú¡£È»ºóÔÙʵÏÖ·½·¨ run¡£
£¨Implement java.lang.Runnable and implement the run method£©
public class MyThread implements Runnable
{
public void run()
{
for (int count = 1, ro
Ïà¹ØÎĵµ£º
ÕâÊÇÎÒÔÚ°²×°ÍêUbuntu9.10ºó´ÓÍøÉÏËѵÄһЩ¹ØÓÚÅäÖÃJava¿ª·¢»·¾³µÄ×ÊÁÏ£¬ÔÚÕâÀïÒªÌرð¸ÐлÔÎÄ×÷ÕßµÄÐÁÇÚÀͶ¯
Ï£ÍûÄÜ°ï·½±ã¸ü¶àµÄÈË£¬ÎÒ»áÔÚUbuntuµÄʹÓùý³ÌÖмÌÐøÊÕ¼¯ºÍ´´×÷һЩÏà¹Ø֪ʶ£¬Ï£ÍûÄܶԴó¼ÒÓÐËù°ïÖú£¡£¡£¡
תÔØÇë±êÃ÷³ö´¦£º
xxm19820127
http://blog.csdn.net/xxm19820127/archive/201 ......
/*
*ÈÕÆÚ:2010-04-18 11:37
*¿ª·¢Õß:heroyan
*ÁªÏµ·½Ê½:zndxysf@126.com
*¹¦ÄÜ:ÎÞÏòͼ×îСÉú³ÉÊ÷PrimË㷨ʵÏÖ°¸Àý
*/
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
public class SpanningTree{
private static int MAX = 100;
private double cost[][] = new doubl ......
JNI¹¤×÷ÔÀí
ÔÚJNIÖУ¬±¾µØº¯ÊýÊÇͨ¹ýÒ»¸ö¶ÀÁ¢µÄ.c»ò.cppÎļþÀ´ÊµÏÖµÄ(C++ΪJNIÌṩµÄ½çÃæ»á¸ü¼ò½àһЩ)¡£µ±JVMµ÷Óøú¯Êýʱ£¬Ëü´«µÝÁËÒ»¸öJNIEnvÖ¸Õë¡¢Ò»¸öjobjectÖ¸ÕëºÍͨ¹ýJava·½·¨¶¨ÒåµÄJava²ÎÊý£¬JNIº¯ÊýµÄÐÎʽÈçÏ£º
JNIEXPORT void JNICALL Java_ClassName_MethodName
(JNIEnv *env, jobjectobj)
{
......
×÷ΪһÃû³ÌÐòÔ±£¬×ÜÒª¾Àú´ÓС¹æÄ£µÄ¾Ö²¿±àÂëת»»µ½´óÐÍÈí¼þÉè¼Æ¡¢¿ª·¢µÄ¹ý³Ì¡£Ôڴ˹ý³ÌÖУ¬ÔÚÊìϤÁ˱à³ÌÓïÑÔºó£¬ÐèÒª½«ÑÛ¹âÉÏÉýÒ»¸ö²ãÃ棬´ÓÕûÌåÈ¥°ÑÎÕÕû¸öÈí¼þµÄ¼Ü¹¹£¬Õë¶ÔÒ»¸öÐÐÒµµÄ¾ßÌåÒµÎñ£¬Äܹ»Éè¼ÆÒ»¸öºÏÀíµÄ¼Ü¹¹£¬Ìá¸ßÈí¼þµÄ¿É¿¿ÐÔ¡¢¿Éά»¤ÐÔ¡¢¿É¸´ÓÃÐÔ¡£¾ÍÏñһλ¾Ñé·á¸»µÄͬÊÂËùË ......
/////////////////////DogTestDrive/////////////////////
class DogTestDrive {
public static void main(String[] args) {
Dog one = new Dog();
one.size = 70;
Dog two = new Dog();
two.size = 8;
......