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

javaÉè¼Æģʽ

ÎÊÌâÓò:
 --ϵͳÖÐÄãÐèÒª»ñµÃij¸öÀàµÄΨһʵÀý£¬ËùÓпͻ§¶Ë¶ÔËüµÄ·ÃÎʶ¼½«Í¨¹ýÒ»¸ö¹«¹²µÄ·ÃÎʵã»ñµÃ
 --´´½¨Ò»¸öÀಢʹÆ䣺(A)¶¨ÒåÒ»¸ö˽ÓеĹ¹ÔìÆ÷£¨B£©¶¨ÒåÒ»¸ö˽ÓС¢¾²Ì¬µÄ±äÁ¿Ö¸Ïò×Ô¼º£¨C£©¶¨ÒåÒ»¸ö¹«ÓС¢¾²Ì¬µÄ·ÃÎÊ·½·¨ÓÃÓÚ·µ»Ø¸ÃÀàµÄÒ»¸öΨһʵÀý
·ÖΪ ¶öººÊ½ ºÍ ÀÁººÊ½,ÏÂÃæÊÇÒ»¸ö¼òµ¥µÄʾÀý´úÂ룬Ӧ¸ÃºÜÈÝÒ×Àí½â£º
package pattern.singleton.basic;
/**
* javaÉè¼Æģʽ£ºµ¥Àýģʽ£¨¶öººÊ½£©
* @author wasw100
*/
public class Singleton {
// Ìṩһ¸ö¾²Ì¬Ë½ÓбäÁ¿Ö¸Ïò×Ô¼º,ÊôÓÚÀà
private static Singleton instance = new Singleton();// ÌáÇ°Ïû·Ñ
// Ìṩ˽Óй¹ÔìÆ÷£¬Ö»ÓÐÔÚµ±Ç°ÀàÖпÉÒÔʹÓÃnew,Íâ½ç²»Äܹ¹Ôì¸ÃÀàµÄ¶ÔÏó
private Singleton() {
}
// ¶ÔÍâÌṩһ¸ö¹«¹²·ÃÎʵã
public static Singleton getInstance() {
return instance;
}
}
2¡¢ÀÁººÊ½´úÂë
package pattern.singleton.basic;
/**
* javaÉè¼Æģʽ£ºµ¥Àýģʽ£¨ÀÁººÊ½£©
* @author wasw100
*/
public class Singleton {
private static Singleton instance = null;
private Singleton(){}

//synchronized±ÜÃâÔÚ·ÃÎÊÁ¿±È½Ï´óµÄʱºò µÚÒ»¸öÏ̵߳Änew Singleton»¹Ã»À´µÃ¼°¸³Öµ¸øinstance£¬µÚ¶þ¸öÏ߳̾ÍÀ´ÁË£¬»¹Òª½øÐÐnew ……
public synchronized static Singleton getInstance(){
if(instance == null){
instance = new Singleton();
}
return instance;
}
}
²âÊÔ´úÂë
package pattern.singleton.basic;
public class ClientClass {
public static void main(String [] args){
Singleton s1 = Singleton.getInstance();
Singleton s2 = Singleton.getInstance();
System.out.println(s1);
System.out.println(s2);
}
}
Êä³ö½á¹û£¨µØÖ·Ïàͬ£¬ËùÒÔÖ¸Ïòͬһ¸ö¶ÔÏ󣩣º
pattern.singleton.basic.Singleton@a90653
pattern.singleton.basic.Singleton@a90653
˵Ã÷£º
¹¹Ôì·½·¨ÊÇ˽Óеģ¬ÍⲿÀ಻ÄÜʵÀý»¯£¬Ö»ÄÜÔÚÀàµÄÄÚ²¿ÊµÀý»¯
¶öººÊ½ÔÚÀà¼ÓÔØʱʵÀý»¯£¬ÀÁººÊ½ÔÚµÚÒ»´Î³ÌÐòµÚÒ»´ÎÖ´ÐÐgetInstance()·½·¨Ê±ÊµÀý»¯
ÀÁººÊ½ÖÐsynchronized±ÜÃâÔÚ·ÃÎÊÁ¿±È½Ï´óµÄʱºò µÚÒ»¸öÏ̵߳Änew Singleton»¹Ã»À´µÃ¼°¸³Öµ¸øinstance£¬µÚ¶þ¸öÏ߳̾ÍÀ´ÁË£¬»¹Òª½øÐÐnew ……


Ïà¹ØÎĵµ£º

java È«ÅÅÁÐËã·¨

 import java.util.Arrays;
/**
 * ÇóÒ»¸öÊý×éµÄÈ«ÅÅÁÐËã·¨
 * @author Administrator
 */
public class Pai { 
 public void pai(char[] array,int start,int end){
  System.out.println(" -- ×éºÏ "+start+" µ½ "+end+" --");
  if(start==end){
  ......

Java»æͼ

ÏÂÃæÊÇÎÒÈÏΪÕýÈ·µÄ×ö·¨£¨½áºÏ×Ô¼ºµÄ¾­ÑéдµÄ£¬Èç¹û²»ÕýÈ·£¬Çë´ó¼ÒÖ¸Õý£©£º
ÎҵĻæͼ¿Ø¼þÊÇJPanel£¬
³öÏÖ¹ö¶¯ÌõµÄÇ°Ìᣬ±ØÐëÈûæͼ¿Ø¼þ·ÅÔÚJScrollPaneÉÏ£¬
¶ÔÓÚJScrollPaneµÄLayout£¬Ã»ÓÐÌØÊâÒªÇó£¬ÏÂÃæÕâÑù¼´¿É£º
jScrollPane1.setViewportView(jPanel1);
È»ºó£¬ÁíÍâά³ÖÒ»¸öBufferedImage£¨¼ÙÉè½Ðimage1£©£¬¸÷ÖÖÍ¼Ï ......

java ·ºÐÍ

ÔÚ
Java SE1.5
ÖУ¬
Ôö¼ÓÁËÒ»¸öеÄÌØÐÔ£º·ºÐÍ£¨ÈÕ±¾ÓïÖеÄ×ܳÆÐÍ£©¡£ºÎν·ºÐÍÄØ£¿Í¨Ë×µÄ˵£¬¾ÍÊÇ·º·ºµÄÖ¸¶¨¶ÔÏóËù²Ù×÷µÄÀàÐÍ£¬¶ø²»Ïñ³£¹æ·½Ê½Ò»ÑùʹÓÃijÖ̶ֹ¨µÄÀàÐÍÈ¥Ö¸¶¨¡£
·ºÐ͵ı¾ÖʾÍÊǽ«Ëù²Ù×÷µÄÊý¾ÝÀàÐͲÎÊý»¯£¬Ò²¾ÍÊÇ˵£¬¸ÃÊý¾ÝÀàÐͱ»Ö¸¶¨ÎªÒ»¸ö²ÎÊý¡£ÕâÖÖ²ÎÊýÀàÐÍ¿ÉÒÔʹÓÃÔÚÀà¡¢½Ó¿ÚÒÔ¼°·½·¨¶¨ÒåÖС£
  ......

FlexÖÐXMLSocketÓëJavaÖÐSocketͨÐÅ

FlexÖÐXMLSocketÓëJavaÖÐSocketͨÐÅ£¬Óöµ½µÄÎÊÌâÊÇ£¬JavaÖеÄsocketÄܹ»½ÓÊܵ½XMLSocket´«ÊäµÄÊý¾Ý£¬µ«ÊÇFlex²¢²»ÄܽÓÊܵ½´ÓJava·þÎñÆ÷´«ÊäµÄÊý¾Ý£¬´ÓÍøÉÏËÑÁ˺öà×ÊÁÏ£¬ÖÕÓÚÕÒµ½ÁËÔ­Òò£¬Ô­À´XMLSocket ½ÓÊÕµ½·þÎñ¶ËÏ·¢µÄÊý¾Ýʱ£¬½«Á¬Ðø·ÅÓÚ½ÓÊÕ»º³åÇø£¬Ö±µ½½ÓÊÕµ½ "\0" ×Ö½Ú£¨×Ö½ÚÄÚÈÝΪ ASCII Öµ 0£©£¬²ÅÈÏΪ½ÓÊÕÍê³É£¬² ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ