Java ÖжÓÁеÄʹÓÃ
¸Õ²Å¿´¼ûȺÀïµÄÒ»¸öÅóÓÑÔÚÎʶÓÁеÄʹÓã¬È·ÊµÔÚÏÖʵµÄд´úÂëÖкÜÉÙʹÓöÓÁеģ¬·´ÕýÎÒÊÇ´ÓÀ´Ã»Ê¹Óùý¡£Ö»ÊÇѧÊý¾Ý½á¹¹µÄʱºòѧ¹ý¡£
ÏÂÃæÊÇÎÒдµÄÒ»¸öСÀý×Ó£¬Ï£ÍûÓв»×ãÖ®´¦ÇëÌá³ö¸ÄÕý¡£O(∩_∩)O~
¿´´úÂ룺
import java.util.LinkedList;
import java.util.Queue;
public class TestQueue
{
/**
* @param args
* @author JavaAlpha
* Info ²âÊÔ¶ÓÁÐ
*/
public static void main(String[] args)
{
Queue<String> queue = new LinkedList<String>();
queue.offer("1");//²åÈëÒ»¸öÔªËØ
queue.offer("2");
queue.offer("3");
//´òÓ¡ÔªËظöÊý
System.out.println("queue.size()"+queue.size());
//±éÀú´òÓ¡ËùÓеÄÔªËØ,°²×°²åÈëÊÇ˳Ðò´òÓ¡
for (String string : queue)
{
System.out.println(string);
}
}
}
´òÓ¡ÄÚÈÝ£º
queue.size()3
1
2
3
ÏÂÃæÊÇAPIÖжԶÓÁеÄ˵Ã÷£º
public interface Queue<E>extends Collection<E>
ÔÚ´¦ÀíÔªËØÇ°ÓÃÓÚ±£´æÔªËØµÄ collection¡£³ýÁË»ù±¾µÄ Collection ²Ù×÷Í⣬¶ÓÁл¹ÌṩÆäËûµÄ²åÈë¡¢ÌáÈ¡ºÍ¼ì²é²Ù×÷¡£Ã¿¸ö·½·¨¶¼´æÔÚÁ½ÖÖÐÎʽ£ºÒ»ÖÖÅ׳öÒì³££¨²Ù×÷ʧ°Üʱ£©£¬ÁíÒ»ÖÖ·µ»ØÒ»¸öÌØÊâÖµ£¨null »ò false£¬¾ßÌåÈ¡¾öÓÚ²Ù×÷£©¡£²åÈë²Ù×÷µÄºóÒ»ÖÖÐÎʽÊÇÓÃÓÚרÃÅΪÓÐÈÝÁ¿ÏÞÖÆµÄ Queue ʵÏÖÉè¼ÆµÄ£»ÔÚ´ó¶àÊýʵÏÖÖУ¬²åÈë²Ù×÷²»»áʧ°Ü¡£
Å׳öÒì³£
·µ»ØÌØÊâÖµ
²åÈë
add(e)
offer(e)
ÒƳý
remove()
poll()
¼ì²é
element()
peek()
¶ÓÁÐͨ³££¨µ«²¢·ÇÒ»¶¨£©ÒÔ FIFO£¨ÏȽøÏȳö£©µÄ·½Ê½ÅÅÐò¸÷¸öÔªËØ¡£²»¹ýÓÅÏȼ¶¶ÓÁÐºÍ LIFO ¶ÓÁУ¨»ò¶ÑÕ»£©ÀýÍ⣬ǰÕ߸ù¾ÝÌṩµÄ±È½ÏÆ÷»òÔªËصÄ×ÔȻ˳Ðò¶ÔÔªËؽøÐÐÅÅÐò£¬ºóÕß°´ LIFO£¨ºó½øÏȳö£©µÄ·½Ê½¶ÔÔªËؽøÐÐÅÅÐò¡£ÎÞÂÛʹÓÃÄÄÖÖÅÅÐò·½Ê½£¬¶ÓÁеÄÍ· ¶¼Êǵ÷Óà remove() »ò poll() ËùÒƳýµÄÔªËØ¡£ÔÚ FIFO ¶ÓÁÐÖУ¬ËùÓеÄÐÂÔªËض¼²åÈë¶ÓÁеÄĩβ¡£ÆäËûÖÖÀàµÄ¶ÓÁпÉÄÜʹÓò»Í¬µÄÔªËØ·ÅÖùæÔò¡£Ã¿¸ö Queue ʵÏÖ±ØÐëÖ¸¶¨Æä˳ÐòÊôÐÔ¡£
Èç¹û¿ÉÄÜ£¬offer ·½·¨¿É²åÈëÒ»¸öÔªËØ£¬·ñÔò·µ»Ø false¡£ÕâÓë Collection.add ·½·¨²»Í¬£¬¸Ã·½·¨Ö»ÄÜͨ¹ýÅ׳öδ¾¼ì²éµÄÒ쳣ʹÌí¼ÓÔªËØʧ°Ü¡£offer ·½·¨Éè¼ÆÓÃÓÚÕý³£µÄʧ°ÜÇé¿ö£¬¶ø²»ÊdzöÏÖÒì³£µÄÇé¿ö£¬ÀýÈçÔÚÈÝÁ¿¹Ì¶¨£¨Óн磩µÄ¶ÓÁÐÖС£
remove() ºÍ poll() ·½·¨¿ÉÒƳýºÍ·µ»Ø¶ÓÁеÄÍ·¡£µ½µ×´Ó¶ÓÁÐÖÐÒƳýÄĸöÔªËØÊǶÓÁÐÅÅÐò²ßÂԵŦÄÜ£¬¶ø¸Ã²ßÂÔÔÚ¸÷ÖÖÊ
Ïà¹ØÎĵµ£º
Ê×ÏÈ£¬½¨3¸ö½Ó¿Ú
FTPOperate.java:
public interface FTPOperate
{
public void execute(FTPBean entity);
}
FTPProxy.java:
public interface FTPProxy
{
public void connection();
public abstract void upload();
public abstract void download();
public void setEntity(FTPBe ......
1.1 J2SE
µÄÖ÷Òª¹¤¾ß
»ù±¾¹¤¾ß£º
javac
Java
±à³ÌÓïÑԵıàÒëÆ÷¡£±¾Êé¸÷ÕµijÌÐò¶¼ÊÇÔÚ
DOS
´°¿ÚÖÐͨ¹ýÖ´ÐÐ
"javac
ÎļþÃû
”
À´±àÒë
Java
³ÌÐòµÄ¡£ÎļþÃû±ØÐëÒÔ
.java
Ϊºó׺£¬±àÒëÒÔºóÉú³É
.class
Ϊºó׺µÄ×Ö½ÚÂëÎļþ¡£
java
ÓÃÓÚÖ´ÐÐ
Java
Ó¦ÓóÌÐò¡£±¾Êé¸÷ÕÂµÄ³Ì ......
1 import
2 package
3 ÐÞÊηû
4 ³éÏóÀà ½Ó¿Ú
5 static
6 StringÏà¹Ø
7 javadoc
8 Òì³£
9 ÈÕÆÚÏà¹Ø
10 ÊäÈëÊä³öÁ÷
11
Ò» import
importÓÃÓÚµ¼È벻ͬ°üÖеÄÀ࣬²»Í¬°üÖеÄÀàÃû¿ÉÒÔÏàͬ¡£
ÓÃ*ºÅÖ»Äܵ¼ÈëÒ»¸ö°ü£¬²»ÄÜʹÓà import java.* »òÕß java.*. ......
JEditorPaneÌṩÈýÖÖÀàÐ͵ÄÎı¾ÏÔʾ£¬text/plain,text/html,text/rtf.
JEditorPaneµÄ¼òµ¥Ó÷¨DEMOÈçÏ£º
package ibees.swing;
import java.awt.Toolkit;
import java.io.IOException;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.event.Hype ......