JavaÊý¾Ý½á¹¹ºÍËã·¨ Õ»Óë¶ÓÁÐ
(1)Õ»
package ChapterOne;
public class Stack {
//Õ»Êý×é
long stackArr[];
//Õ»µÄ´óС
int maxSize;
//Õ»µÄ¶¥²¿
int top;
//³õʼ»¯Ò»¸ö´óСΪsizeµÄÕ»
public Stack(int size){
maxSize = size;
stackArr = new long[size];
top = -1;
}
//³öÕ»²Ù×÷
public long pop(){
return stackArr[top--];
}
//½øÕ»²Ù×÷
public void push(long value){
stackArr[++top] = value;
}
//ÅжÏÕ»ÊÇ·ñΪ¿Õ
public boolean isEmpty(){
return top == -1;
}
//ÅжÏÕ»ÊÇ·ñÒÑÂú
public boolean isFull(){
return top == maxSize-1;
}
//È¡Õ»¶¥ÔªËØ
public long peek(){
return stackArr[top];
}
public static void main(String[] args) {
Stack stack = new Stack(10);
while(!stack.isFull()){
long v = (long) (Math.random()*100);
stack.push(v);
System.out.print(v+" ");
}
System.out.println();
while(!stack.isEmpty()){
long topValue = stack.pop();
System.out.print(topValue+" ");
}
System.out.println();
}
}
(2)¶ÓÁÐ
package ChapterOne;
public class Queue {
//¶ÓÁÐÊý×é
private long queueArr[];
//¶ÓÁеÄÇ°¶Ëϱê
private int front;
//¶ÓÁеÄβ¶Ëϱê
private int rear;
//¶ÓÁеĴóС
private int maxSize;
//¶ÓÁÐÖÐÔªËصĸöÊý
private int nItems;
//³õʼ»¯Ò»¸ö´óСΪsizeµÄ¶ÓÁÐ
public Queue(int size){
queueArr = new long[size];
maxSize = size;
front = 0;
rear = -1;
nItems = 0;
}
//²åÈë²Ù×÷
public void insert(long value){
//¶ÓÁÐÒÑÂú
if(rear == maxSize-1)
rear = -1;
queueArr[++rear] = value;
nItems++;
}
//ɾ³ý²Ù×÷
public long remove(){
long temp = queueArr[front++];
if(front == maxSize)
front = 0;
nItems--;
return temp;
}
//·µ»Ø¶ÓÁеÚÒ»¸öÔªËØ
public long peakFront(){
return queueArr[front];
}
//ÅжÏÊÇ·ñΪ¿Õ
public boolean isEmpty(){
return nItems == 0;
}
//ÅжÏÊÇ·ñÒÑÂú
public boolean isFull(){
return nItems == maxSize;
}
//·µ»Ø¶ÓÁÐÖÐÔªËصĸöÊý
public int size(){
return nItems;
}
public void print(){
for(int i =
Ïà¹ØÎĵµ£º
JavaỊ̈߳ºÐÂÌØÕ÷-ÐźÅÁ¿
JavaµÄÐźÅÁ¿Êµ¼ÊÉÏÊÇÒ»¸ö¹¦ÄÜÍê±ÏµÄ¼ÆÊýÆ÷£¬¶Ô¿ØÖÆÒ»¶¨×ÊÔ´µÄÏû·ÑÓë»ØÊÕÓÐןÜÖØÒªµÄÒâÒ壬ÐźÅÁ¿³£³£ÓÃÓÚ¶àÏ̵߳ĴúÂëÖУ¬²¢Äܼà¿ØÓжàÉÙÊýÄ¿µÄÏ̵߳ȴý»ñÈ¡×ÊÔ´£¬²¢ÇÒͨ¹ýÐźÅÁ¿¿ÉÒÔµÃÖª¿ÉÓÃ×ÊÔ´µÄÊýÄ¿µÈµÈ£¬ÕâÀï×ÜÊÇÔÚÇ¿µ÷“ÊýÄ¿”¶þ×Ö£¬µ«²»ÄÜÖ¸³öÀ´ÓÐÄÄЩÔڵȴý£¬ÄÄЩ×ÊÔ ......
JavaỊ̈߳ºÐÂÌØÕ÷-×èÈû¶ÓÁÐ
×èÈû¶ÓÁÐÊÇJava5Ïß³ÌÐÂÌØÕ÷ÖеÄÄÚÈÝ£¬Java¶¨ÒåÁË×èÈû¶ÓÁеĽӿÚjava.util.concurrent.BlockingQueue£¬×èÈû¶ÓÁеĸÅÄîÊÇ£¬Ò»¸öÖ¸¶¨³¤¶ÈµÄ¶ÓÁУ¬Èç¹û¶ÓÁÐÂúÁË£¬Ìí¼ÓÐÂÔªËصIJÙ×÷»á±»×èÈûµÈ´ý£¬Ö±µ½ÓпÕλΪֹ¡£Í¬Ñù£¬µ±¶ÓÁÐΪ¿Õʱºò£¬ÇëÇó¶ÓÁÐÔªËصIJÙ×÷ͬÑù»á×èÈûµÈ´ý£¬Ö±µ½ÓпÉÓÃÔªËØΪ ......
JavaỊ̈߳ºÐÂÌØÕ÷-Ô×ÓÁ¿
ËùνµÄÔ×ÓÁ¿¼´²Ù×÷±äÁ¿µÄ²Ù×÷ÊÇ“Ô×ӵĔ£¬¸Ã²Ù×÷²»¿ÉÔÙ·Ö£¬Òò´ËÊÇḬ̈߳²È«µÄ¡£
ΪºÎҪʹÓÃÔ×Ó±äÁ¿ÄØ£¬ÔÒòÊǶà¸öÏ̶߳Ե¥¸ö±äÁ¿²Ù×÷Ò²»áÒýÆðһЩÎÊÌâ¡£ÔÚJava5֮ǰ£¬¿ÉÒÔͨ¹ývolatile¡¢synchronized¹Ø¼ü×ÖÀ´½â¾ö²¢·¢·ÃÎʵݲȫÎÊÌ⣬µ«ÕâÑùÌ«Âé·³¡£
Java5Ö®ºó£¬× ......
Java Éú³É EXCEL POIÎĵµËµÃ÷
POI°æ±¾:3.0.2-FINAL
ÏÂÔصØÖ·: http://poi.apache.org/index.html
Ò»°ãÔÚÏîÄ¿ÖÐÕæÕýҪʵÏÖÕâÑùÒ»¸ö±í¸ñµÄʱºò£¬ÀýÈçÏîÄ¿ÐèÒªÖÆ×÷±¨±íµÈµÈ£¬Í¨³£µÄ×ö·¨¶¼ÊÇÊÂÏȰѸñʽһÇеĶ«Î÷¶¼ÊÖ¶¯ÖÆ×÷ºÃ£¨Õâ¸ö×öºÃÁ˵ÄÎļþÔÚʵ¼ÊµÄÏîÄ¿ÀïÎÒÃdzÆ֮Ϊ“Êý¾ÝÄ£°å”£¬¼ò³Æ“Ä£°å&rd ......
/**
* Õâ¶Î³ÌÐò²¢²»ÄÑ£¬Ó¦¸ÃºÜºÃ¿´¶®£¬ÎҰѹý³Ì´óÖ½²Ò»Ï£¬Ê×ÏÈÄãµÄÄÔ×ÓÀïÏȸ¡ÏÖÒ»¸öÊý×éºÍÈý¸öÖ¸Õ룬
* µÚÒ»¸öÖ¸Õë³ÆΪpÖ¸Õ룬ÔÚÕû¸ö¹ý³Ì½áÊø֮ǰËüÀÎÀεÄÖ¸ÏòµÚÒ»¸öÊý£¬µÚ¶þ¸öÖ¸ÕëºÍµÚÈý¸öÖ¸Õë·Ö±ðΪloÖ¸ÕëºÍhiÖ¸Õ룬
* ·Ö±ðÖ¸Ïò×î×ó±ßµÄÖµºÍ×îÓұߵÄÖµ¡£loÖ¸ÕëºÍhiÖ¸Õë´ÓÁ½±ßͬ ......