Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

LRUÒ³ÃæÖû»Ë㷨ģÄâJavaʵÏÖ....

import java.io.BufferedReader;
import java.io.InputStreamReader;
public class LRU {
 int blockCount;
 int seriaCount;
 int[] address;
 int[] stack;
 BufferedReader br;
 public static void main(String[] args) {
  // int address[] = { 1, 2,3, 2, 8, 4, 3, 9, 4, 1, 2, 4, 6, 8, 2 };
  LRU lru = new LRU();
  lru.init();
  lru.display();
  System.out.println("=====LRUÑÝʾËã·¨½áÊø=====");
  System.out.println("ϵͳÍ˳ö£¡£¡£¡");
  
 }
 public void init() {
  try {
   br = newBufferedReader(new InputStreamReader(System.in));
  } catch (Exception e) {
   e.printStackTrace();
   System.exit(0);
  }
  System.out.println("===LRUÒ³ÃæÖû»Ëã·¨ÑÝʾ===");
  System.out.println("ÇëÊäÈëÎïÀí¿éÊý:");
  blockCount = readInt();
  stack = newint[blockCount];
  System.out.println("ÇëÊäÈë·ÃÎÊÄÚ´æµÄ¿éÐòÁеĸöÊý:");
  seriaCount = readInt();
  System.out.println("ÇëÊäÈë·ÃÎÊÄÚ´æµÄ" +seriaCount + "¿éÐòÁÐ,ÖмäÒѿոñ·Ö¸ô:");
  address = readIntArray();
 }
 public void display() {
  // int[] stack = newint[4];
  boolean flag;
  System.out.println("µØÖ·ÐòÁУº");
  for (int m = 0; m< address.length; m++)
   System.out.print(address[m]+ " ");
  System.out.print("\n");
  System.out.println("Öð´ÎµÄ½»»»Çé¿ö£º");
  for (int i = 0; i< address.length; i++) {
   int j =0;
   flag =false;
   int t, temp =address[i];
   while(stack[j] != address[i]) {
    t= stack[j];
    stack[j]= temp;
    temp= t;
    j++;
    if(temp == 0 || j == stack.length)


Ïà¹ØÎĵµ£º

java¶ÔÏóÐòÁл¯Ñ§Ï°±Ê¼Ç

    ÐòÁл¯µÄ¹ý³Ì¾ÍÊǶÔÏóдÈë×Ö½ÚÁ÷ºÍ´Ó×Ö½ÚÁ÷ÖжÁÈ¡¶ÔÏó¡£½«¶ÔÏó״̬ת»»³É×Ö½ÚÁ÷Ö®ºó£¬¿ÉÒÔÓÃjava.io°üÖеĸ÷ÖÖ×Ö½ÚÁ÷ÀཫÆä±£´æµ½ÎļþÖУ¬¹ÜµÀµ½ÁíÒ»Ïß³ÌÖлòͨ¹ýÍøÂçÁ¬½Ó½«¶ÔÏóÊý¾Ý·¢Ë͵½ÁíÒ»Ö÷»ú¡£¶ÔÏóÐòÁл¯¹¦Äܷdz£¼òµ¥¡¢Ç¿´ó£¬ÔÚRMI¡¢Socket¡¢JMS¡¢EJB¶¼ÓÐÓ¦Ó᣶ÔÏóÐòÁл¯ÎÊÌâÔÚÍøÂç±à³ÌÖв¢²»ÊÇ× ......

¡ï¡ï¡ï¡ï¡ïÕ⼸ÌìµÄjavaѧϰ

      Õ⼸ÌìµÄѧϰ ÈÃÎҸе½·¢ã£¬ÀÏʦ½²µÄºÜ¶à£¬×Ô¼º¾Í¸ù±¾ÎÞ·¨È¥Ë¼¿¼£¬Ö»ÄÜÒ»¸ö¾¢µÄÍùÀïÌý£¬×Ô¼º´úÂëÒ²²»Ôõô»á£¬ÀÏʦ½²¹ýµÄÄÜÓиöÓ¡Ïó£¬ ²»¹ý½ñÌ컹ºÃ£¬½²µ½ÁËJava»ù´¡¼ÓÇ¿£¬ÉÔ΢¸Ð¾õºÃµã£¬²¢²»ÊǺÜÄÑÀí½âÁË£¬½ñÌì¾Í¿ªÊ¼½ñÌì¿Î³ÌµÄ¸´Ï°ÁË£¬ÒªÏë½ø²½£¬Ö»ÓÐ×Ô¼º¼è¿àŬÁ¦À²£¡
    È· ......

javaС֪ʶ

(1)JavaÖеÄÖ÷·½·¨public static void main(String args[])ΪʲôҪÓÃstaticÀ´ÐÞÊÎ
ÒòΪjavaÊÇÍêÈ«ÃæÏò¶ÔÏóÓïÑÔ,Õâ¸öÖ÷º¯ÊýÆäʵÊÇÒ»¸öÀàµÄ·½·¨,Õâ¸ö·½·¨ÔÚÀàûÓÐÉú³É¶ÔÏóµÄʱºò¾Í±ØÐë±»JVMµ÷ÓÃ,ËùÒÔËü±ØÐëÊǾ²Ì¬µÄ³ÉÔ±º¯Êý.
 £¨2£©javaÓïÑÔÖеÄpublic static void main(String[] args) ×÷ÓÃÊÇʲô.Ëù×öµÄÊÂÇéÓÖÊÇʲ ......

[JAVAÓëģʽ]ѧϰ±Ê¼Ç Ò»

      ×÷ΪһÃû³ÌÐòÔ±£¬×ÜÒª¾­Àú´ÓС¹æÄ£µÄ¾Ö²¿±àÂëת»»µ½´óÐÍÈí¼þÉè¼Æ¡¢¿ª·¢µÄ¹ý³Ì¡£Ôڴ˹ý³ÌÖУ¬ÔÚÊìϤÁ˱à³ÌÓïÑÔºó£¬ÐèÒª½«ÑÛ¹âÉÏÉýÒ»¸ö²ãÃæ£¬´ÓÕûÌåÈ¥°ÑÎÕÕû¸öÈí¼þµÄ¼Ü¹¹£¬Õë¶ÔÒ»¸öÐÐÒµµÄ¾ßÌåÒµÎñ£¬Äܹ»Éè¼ÆÒ»¸öºÏÀíµÄ¼Ü¹¹£¬Ìá¸ßÈí¼þµÄ¿É¿¿ÐÔ¡¢¿Éά»¤ÐÔ¡¢¿É¸´ÓÃÐÔ¡£¾ÍÏñһλ¾­Ñé·á¸»µÄͬÊÂËùË ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ