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

javaÊý¾Ý½á¹¹Ö®¶ÓÁÐ

ÔÚʹÓöÓÁÐÖУ¬ÎÒÃÇÒ»°ã¶¼»áʹÓÃÑ­»·¶ÓÁÐÒÔ±£Ö¤ÐÔÄÜ
package com.yz.myqueue;
public class Queue {
private Integer size;
private Integer front;
private Integer rear;
private Object[] datas;
public Queue(int size){
this.size=size;
this.front=-1;
this.rear=-1;
datas=new Object[size];
}

public static void main(String[] args){
Queue qu=new Queue(2);
qu.enQueue("aa");
qu.enQueue("bb");

qu.enQueue("cc");

System.out.println("³öÕ»:"+qu.outQueue());
System.out.println("³öÕ»:"+qu.outQueue());
System.out.println("³öÕ»:"+qu.outQueue());
System.out.println("³öÕ»:"+qu.outQueue());
}
public void enQueue(Object data){
if(!isFull()){
if(this.isEmpty()){
front=rear=0;
}else{
rear=(rear+1)%size;
}
System.out.println("ÔÚ"+rear+"²åÈë"+data);
datas[rear]=data;
}else{
System.out.println("´æ´¢¼ºÂú£¡");
}
}

public Object outQueue(){
Object data;
if(isEmpty()){
data= null;
}else{
data=datas[front];
if(front==rear){
datas[front]=null;
this.clear();
}else{
front=(front+1)%size;
}
}
return data;
}
public Boolean isEmpty(){
return front==-1;
}
public Boolean isFull(){
return (rear+1)%size==front;
}
public void clear(){
front=rear=-1;
}

}


Ïà¹ØÎĵµ£º

java Ḭ̈߳²È«

Servlet/JSP¼¼ÊõºÍASP¡¢PHPµÈÏà±È£¬ÓÉÓÚÆä¶àÏß³ÌÔËÐжø¾ßÓкܸߵÄÖ´ÐÐЧÂÊ¡£ÓÉÓÚServlet/JSPĬÈÏÊÇÒÔ¶àÏß³ÌģʽִÐеģ¬ËùÒÔ£¬ÔÚ±àд´úÂëʱÐèÒª·Ç³£Ï¸Öµؿ¼ÂǶàÏ̵߳ݲȫÐÔÎÊÌ⡣Ȼ¶ø£¬ºÜ¶àÈ˱àдServlet/JSP³ÌÐòʱ²¢Ã»ÓÐ×¢Òâµ½¶àḬ̈߳²È«ÐÔµÄÎÊÌ⣬ÕâÍùÍùÔì³É±àдµÄ³ÌÐòÔÚÉÙÁ¿Óû§·ÃÎÊʱûÓÐÈκÎÎÊÌ⣬¶øÔÚ²¢·¢Óû§ÉÏÉýµ ......

JavaÀíÂÛÓëʵ¼ù: Ãè»æḬ̈߳²È«ÐÔ

Java ÀíÂÛÓëʵ¼ù: Ãè»æḬ̈߳²È«ÐÔ
2007-12-15 00:10
——Ḭ̈߳²È«²»ÊÇÒ»¸ö·ÇÕæ¼´¼ÙµÄÃüÌâ
Brian Goetz (brian@quiotix.com), Ê×ϯ¹ËÎÊ, Quiotix Corp
2003 Äê 11 ÔÂ 15 ÈÕ
7Ô·ÝÎÒÃǵIJ¢·¢×¨¼Ò Brian Goetz ½« Hashtable ºÍ Vector ÀàÃèÊöΪ“ÓÐÌõ¼þḬ̈߳²È«µÄ”¡£Ò»¸öÀàÄѵÀ²»ÊÇḬ̈߳²È«¾ÍÊÇÏß³Ì ......

javaÖÐʹ´°¿Ú¾ÓÖÐÏÔʾ

Èç¹ûҪʹÖ÷´°¿Ú ¾ÓÖÐÒ»°ãʹÓÃÏÂÃæµÄ·½·¨£º
import javax.swing.*;
import java.awt.*;
public class ToCenter
{
  public ToCenter(JFrame frame)
   {
       //---------------------------ÉèÖô°¿Ú¾ÓÖÐ---------------------------------------------------- ......

diyÃæÏòÇëÇóµÄjava¿ò¼Ü

Õâ¸ö¿ò¼ÜÒ²ÊÇΪgoogle app engine×¼±¸µÄ¡£µ±Ê±¸Ð¾õÖ±½ÓÔÚgaeÉÏsevletÌ«·³ÈËÁË£¬¾Í·â×°¸ö¼òÒ׵Ŀò¼Ü¡£Ê¹ÓõÄʱºòÖ»ÐèÒªÅäÖÃweb.xmlÖÐDispacherSevletºÍpackage.propertiesÖеÄpackage.path£¨Ä¬ÈÏɨÃèµÄ°ü£©¼´¿É
gaeÀý×Ó£ºhttp://orzblogs.appspot.com/Home.htm
´óѧµÄʱºòºÜBS java£¬Ñ§ÁËÖ®ºó¾ÍÈÓµôÁË£¬ÏÖÔÚ¹¤×÷Á˲ſªÊ¼ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ