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

Java½â»ó3 24¾¡ÇéÏíÊÜÿһ¸ö×Ö½Ú

ÏÂÃæµÄ³ÌÐòÑ­»·±éÀúbyteÊýÖµ£¬ÒÔ²éÕÒij¸öÌض¨Öµ¡£Õâ¸ö³ÌÐò»á´òÓ¡³öʲôÄØ£¿
public class BigDelight {
public static void main(String[] args) {
for (byte b = Byte.MIN_VALUE; b < Byte.MAX_VALUE; b++) {
if (b == 0x90)
System.out.print("Joy!");
}
}
}
Õâ¸öÑ­»·ÔÚ³ýÁËByte.MAX_VALUEÖ®ÍâËùÓеÄbyteÊýÖµÖнøÐеü´ú£¬ÒÔ²éÕÒ0x90¡£Õâ¸öÊýÖµÊʺÏÓÃbyte±íʾ£¬²¢ÇÒ²»µÈÓÚByte.MAX_VALUE£¬Òò´ËÄã¿ÉÄÜ»áÏëÕâ¸öÑ­»·Ôڸõü´ú»áÕÒµ½ËüÒ»´Î£¬²¢½«´òÓ¡³öJoy!¡£µ«ÊÇ£¬Ëù¼ûΪÐé¡£Èç¹ûÄãÔËÐиóÌÐò£¬¾Í»á·¢ÏÖËüûÓдòÓ¡Èκζ«Î÷¡£Ôõô»ØÊ£¿
¼òµ¥µØ˵£¬0x90ÊÇÒ»¸öint³£Á¿£¬Ëü³¬³öÁËbyteÊýÖµµÄ·¶Î§¡£ÕâÓëÖ±¾õÊÇÏà㣵ģ¬ÒòΪ0x90ÊÇÒ»¸öÁ½Î»µÄÊ®Áù½øÖÆ×ÖÃæ³£Á¿£¬Ã¿Ò»¸öÊ®Áù½øÖÆλ¶¼Õ¼¾Ý4¸ö±ÈÌصÄλÖã¬ËùÒÔÕû¸öÊýÖµÒ²Ö»Õ¼¾Ý8¸ö±ÈÌØ£¬¼´1¸öbyte¡£ÎÊÌâÔÚÓÚbyteÊÇÓзûºÅÀàÐÍ¡£³£Á¿0x90ÊÇÒ»¸öÕýµÄ×î¸ßλ±»ÖÃλµÄ8λintÊýÖµ¡£ºÏ·¨µÄbyteÊýÖµÊÇ´Ó-128µ½+127£¬µ«ÊÇint³£Á¿0x90µÈÓÚ+144¡£
ÄÃÒ»¸öbyteÓëÒ»¸öint½øÐеıȽÏÊÇÒ»¸ö»ìºÏÀàÐͱȽϣ¨mixed-type comparison£©¡£Èç¹ûÄã°ÑbyteÊýÖµÏëÏóΪƻ¹û£¬°ÑintÊýÖµÏëÏó³ÉΪ½Û×Ó£¬ÄÇô¸Ã³ÌÐò¾ÍÊÇÔÚÄÃÆ»¹ûÓë½Û×ӱȽϡ£Ç뿼ÂDZí´ïʽ((byte)0x90 == 0x90)£¬¾¡¹ÜÍâ±í¿´ÆðÀ´ÊdzÉÁ¢µÄ£¬µ«ÊÇËüÈ´µÈÓÚfalse¡£
ΪÁ˱ȽÏbyteÊýÖµ(byte)0x90ºÍintÊýÖµ0x90£¬Javaͨ¹ýÍØ¿íԭʼÀàÐÍת»»½«byteÌáÉýΪһ¸öint[JLS 5.1.2]£¬È»ºó±È½ÏÕâÁ½¸öintÊýÖµ¡£ÒòΪbyteÊÇÒ»¸öÓзûºÅÀàÐÍ£¬ËùÒÔÕâ¸öת»»Ö´ÐеÄÊÇ·ûºÅÀ©Õ¹£¬½«¸ºµÄbyteÊýÖµÌáÉýΪÁËÔÚÊý×ÖÉÏÏàµÈµÄintÊýÖµ¡£ÔÚ±¾ÀýÖУ¬¸Ãת»»½«(byte)0x90ÌáÉýΪintÊýÖµ-112£¬Ëü²»µÈÓÚintÊýÖµ0x90£¬¼´+144¡£
ÓÉÓÚϵͳ×ÜÊÇÇ¿ÖƵؽ«Ò»¸ö²Ù×÷ÊýÌáÉýµ½ÓëÁíÒ»¸ö²Ù×÷ÊýÏàÆ¥ÅäµÄÀàÐÍ£¬ËùÒÔ»ìºÏÀàÐͱȽÏ×ÜÊÇÈÝÒ×°ÑÈ˸ãºýÍ¿¡£ÕâÖÖת»»ÊDz»¿ÉÊӵģ¬¶øÇÒ¿ÉÄܲ»»á²úÉúÄãËùÆÚÍûµÄ½á¹û¡£ÓÐÈô¸ÉÖÖ·½·¨¿ÉÒÔ±ÜÃâ»ìºÏÀàÐͱȽϡ£ÎÒÃǼÌÐøÓйØË®¹ûµÄ±ÈÓ÷£¬Äã¿ÉÒÔÑ¡ÔñÄÃÆ»¹ûÓëÆ»¹û±È½Ï£¬»òÕßÊÇÄýÛ×ÓÓë½Û×ӱȽϡ£Äã¿ÉÒÔ½«intתÐÍΪbyte£¬Ö®ºóÄã¾Í¿ÉÒÔÄÃÒ»¸öbyteÓëÁíÒ»¸öbyte½øÐбȽÏÁË£º
if (b == (byte)0x90)
System.out.println("Joy!");
»òÕߣ¬Äã¿ÉÒÔÓÃÒ»¸öÆÁ±ÎÂëÀ´Ïû³ý·ûºÅÀ©Õ¹µÄÓ°Ï죬´Ó¶ø½«byteתÐÍΪint£¬Ö®ºóÄã¾Í¿ÉÒÔÄÃÒ»¸öintÓëÁíÒ»¸öint½øÐбȽÏÁË£º
if ((b & 0xff) == 0x90)
System.out.print("Joy!");
ÉÏÃæµÄÁ½¸ö½â¾ö·½°¸¶¼


Ïà¹ØÎĵµ£º

javaÖзÃÎÊmemcache

ÓÃspyºÍmemcached for  javaÁ½ÖÖ·½Ê½¶Ômemcache½øÐвÙ×÷
Ò»¡¢spy
package com.test.memcache;
import java.net.InetSocketAddress;
import java.util.concurrent.Future;
import net.spy.memcached.MemcachedClient;
/**
 * ±¾ÀàÓõİüÊÇmemcached-2.4.1.jar
 *  ÏÂÔصØÖ·£º http://code.googl ......

JavaµÄÄÚ´æй©ºÍÀ¬»ø»ØÊÕ»úÖÆ

      JAVA»á²úÉúÄÚ´æй¶Âð£¿Ê×ÏÈ£¬´ð°¸Êǿ϶¨µÄ¡£JavaËäÈ»ÓÐÀ¬»ø»ØÊÕÆ÷£¬µ«ÒÀÈ»´æÔÚй©¡£
      JavaÄÚ´æй©¸úC/C++ÄÚ´æй©µÄ¸ÅÄî²»Ò»Ñù£ºC/C++µÄÄÚ´æй©ÊÇÖ¸MallocÁËһЩ×ÊÔ´£¬×îºóûÓÐfreeµô£¬ÄÚ´æûÓлØÊÕ£¬Õâ¸öÊÇÕæÕýÒâÒåÉϵÄÄÚ´æºÚ¶´£»¶øJavaµÄй©Ôò ......

javaѧϰС¼ÇÒ»

                                                   ......

Ò»¸öJava³ÌÐòÔ±Ó¦¸ÃÕÆÎÕµÄ10Ïî¼¼ÄÜ


1¡¢Óï·¨£º±ØÐë±È½ÏÊìϤ£¬ÔÚд´úÂëµÄʱºòIDEµÄ±à¼­Æ÷¶ÔijһÐб¨´íÓ¦¸ÃÄܹ»¸ù¾Ý±¨´íÐÅÏ¢ÖªµÀÊÇʲôÑùµÄÓï·¨´íÎó²¢ÇÒÖªµÀÈκÎÐÞÕý¡£
2¡¢ÃüÁ±ØÐëÊìϤJDK´øµÄһЩ³£ÓÃÃüÁî¼°Æä³£ÓÃÑ¡ÏÃüÁîÖÁÉÙÐèÒªÊìϤ£ºappletviewer¡¢ HtmlConverter¡¢jar¡¢ java¡¢javac¡¢javadoc¡¢javap¡¢javaw¡¢native2ascii¡¢serialver£¬Èç¹ûÕâЩÃüÁ ......

Java½â»ó2 23²»ÀÍÎÞ»ñ

ÏÂÃæµÄ³ÌÐò½«´òÓ¡Ò»¸öµ¥´Ê£¬ÆäµÚÒ»¸ö×ÖĸÊÇÓÉÒ»¸öËæ»úÊýÉú³ÉÆ÷À´Ñ¡ÔñµÄ¡£ÇëÃèÊö¸Ã³ÌÐòµÄÐÐΪ£º
import java.util.Random;
public class Rhymes {
private static Random rnd = new Random();
public static void main(String[] args) {
StringBuffer word = null;
switch(rnd.nextInt(2)) {
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ