Java»ù±¾Êý¾ÝÀàÐ͵ÄÈ¡Öµ·¶Î§
ÏÈ¿´Ò»¶Î´úÂë
public class Hello{
public static void main(String[] args){
int i = 5 , j = 2;
System.out.println(i+j);
System.out.println(i-j);
System.out.println(i*j);
System.out.println(i/j);
}
}
±àÒëÔËÐÐÍêÉÏÃæµÄ´úÂëºó»áµÃµ½¸÷ÌõÖ¸ÁîÔËÐеĽá¹û£º7£¬3£¬10£¬2
Õâ¾ÍÊÇJAVAÀïÃæµÄ¼Ó¼õ³Ë³ýÔËË㣬Ϊʲô5³ýÒÔ2²»µÈÓÚ2.5¶øµÈÓÚ2ÄØ£¿ÕâÊÇÒòΪÕâÀï×öµÄÊÇÕûÊýµÄËÄÔòÔËË㣬5³ýÒÔ2µÄ½á¹ûÊÇ2£¬¶øÓàÊýΪ1£¬ÎÒÃÇ¿ÉÒÔÔÚÉÏÃæµÄ´úÂëÉϼÓÉÏÒ»ÌõÖ¸Áî
System.out.println(i%j);
ÔËÐÐÕâ¸ö½á¹û¾Í»áµÃµ½ÓàÊý 1£¬Õâ¸ö “%”Ö´ÐеÄÇóÓ࣬»òÕß½ÐÈ¡Ä£¡£
ÏëÒªµÃµ½5/2=2.5Õâ¸ö½á¹û£¬ÎÒÃÇÐèÒª¸Ä±ä¶ÔiºÍjµÄ¶¨Òå
°Ñ int i = 5 , j=2; ¸Äд³Édouble i =5 , j = 2;
ÔÙ±àÒëÔËÐÐÒ»´Î£¬»áµÃµ½ÈçϵĽá¹û: 7.0 , 3.0 , 10.0 , 2.5.
¿ÉÒÔ¿´µ½½á¹û¶¼·¢ÉúÁ˱仯£¬±ä³ÉÁË´øСÊýµãµÄ£¬ÎÒÃdzÆ֮Ϊ¸¡µãÐͳ£Á¿¡£
¸úÇ°ÃæµÄÀý×ÓÒ»Ñù£¬ÎÒÃÇҲʹÓÃÁËÕâÑùµÄ¶¨Òå·½·¨
int i = 5,j = 2;
Scanner s = new Scanner(System.in);
Ç°Ãæ˵¹ý£¬ÎÒÃÇÔÚÕâÀïÊǶ¨ÒåÁËÒ»¸öScannerÀàÐ͵ÄÒýÓñäÁ¿£¬ËüÖ¸ÏòÒ»¸öScanner¶ÔÏ󣬵«ÊÇÕâÀï¸úÒÔÇ°Óе㲻һÑù£¨´ó¸ÅÊÇjavaÖнöÓеļ¸´¦²»Ò»ÑùµÄµØ·½ÁË£©£¬ÎÒÃǶ¨ÒåÁËÒ»¸öintÐ͵ıäÁ¿i£¬È»ºó°ÑËüµÄÖµ¸³³É5£¨²»ÊÇÖ¸Ïò5£©£¬ÒÔºóÓõ½ËüµÄµØ·½¾ÍÏ൱ÓÚÔÚÓÃ5×ö¼ÆËã¡£
intÊÇÎÒÃdz£Óõ½°ËÖÖ»ù±¾Êý¾ÝÀàÐÍÖ®Ò»£¬Ëü±íʾÕûÊýÐÍ¡£
ÔÚJAVAÖÐÒ»¹²ÓаËÖÖ»ù±¾Êý¾ÝÀàÐÍ£¬ËûÃÇ·Ö±ðÊÇ
byte¡¢short¡¢int¡¢long¡¢float¡¢double¡¢char¡¢boolean
ÕûÐÍ
ÆäÖÐbyte¡¢short¡¢int¡¢long¶¼ÊDZíʾÕûÊýµÄ£¬Ö»²»¹ýËûÃǵÄÈ¡Öµ·¶Î§²»Ò»Ñù
byteµÄÈ¡Öµ·¶Î§Îª-128~127£¬Õ¼ÓÃ1¸ö×Ö½Ú£¨-2µÄ7´Î·½µ½2µÄ7´Î·½-1£©
shortµÄÈ¡Öµ·¶Î§Îª-32768~32767£¬Õ¼ÓÃ2¸ö×Ö½Ú£¨-2µÄ15´Î·½µ½2µÄ15´Î·½-1£©
intµÄÈ¡Öµ·¶Î§Îª£¨-2147483648~2147483647£©£¬Õ¼ÓÃ4¸ö×Ö½Ú£¨-2µÄ31´Î·½µ½2µÄ31´Î·½-1£©
longµÄÈ¡Öµ·¶Î§Îª£¨-9223372036854774808~9223372036854774807£©£¬Õ¼ÓÃ8¸ö×Ö½Ú£¨-2µÄ63´Î·½µ½2µÄ63´Î·½-1£©
¿ÉÒÔ¿´µ½byteºÍshor
Ïà¹ØÎĵµ£º
¶ÔÓÚjavaµÄÍøÂç±à³ÌÊéÖÐÌÖÂÛµÄÈ«²¿¹éÄÉÆðÀ´ÓÐSocketµÄʹÓã¬DatagramSocketµÄʹÓã¬javaÓëCGIµÄÅäºÏʹÓã¬javaÁ¬½ÓÊý¾Ý¿âÒÔ¼°javaÖе÷ÓÃÔ¶³Ì·½·¨¡£
Ê×ÏÈÊÇSocketµÄʹÓ㬶ÔÓÚ·þÎñ¶ËÀ´Ëµ£¬Ó¦¸ÃÉùÃ÷µÄÊÇServerSocket¶ÔÏó£¬È»ºóʹÓÃSocket
accept()·½·¨½øÐÐ ......
ÔÚÉÏһƪÎÄÕ¡¶ÔÚJavaÖÐÀûÓö¯Ì¬´úÀíʵÏÖÊý¾Ý¿âÁ¬½ÓÓëÊÂÎñµÄ×Ô¶¯¹ÜÀí¡·½²ÊöÁËÈçºÎʹÓÃJava¶¯Ì¬´úÀí£¬µ«ÒªÇó±»´úÀí¶ÔÏóҪʵÏÖÒ»¸ö½Ó¿Ú£¬Èç¹û²»ÏëʵÏÖ½Ó¿ÚÔõô°ìÄØ£¿Ê¹ÓÿªÔ´µÄcglib¿ÉÒÔʵÏÖ¶ÔÒ»¸öÀà¶ÔÏóµÄ´úÀí£¬¶ø²»ÒªÇóʵÏÖ½Ó¿Ú¡£
cglib£¨Code Generation Library£©Äܹ»ÔÚ³ÌÐòÔË ......
³£¿´µ½ºÜ¶àÈËÌÖÂÛjavaÖйØÓÚStringµÄÎÊÌâ,ÎÒÒ²¾ÍÓеãÐËȤÁË,¼øÓÚÍøÉϺܶàÈËдµÄ¶¼²î±ðºÜ´ó,
ͬÑùµÄÎÊÌⶼÊDz»Í¬µÄ˵·¨,ÎÒºÜÃÔºý,»¨ÁËÒ»ÍíÉ϶ÁÁËJava Virtual Machine SpecificationºÍ
The Java Language SpecificationµÄһЩÕ½Ú,×öÁ˺ܶàÊÔÑé,×ܽáÁËһϹØÓÚStringµÄÄÚÈÝ,»¹
ÓкܶàÄÚÈÝÎÒÒ²²»È·¶¨,ÔÚÏÂÃæÒ²¶¼Ìá³öÀ´ÁË,Ï ......
ÔÎÄ: http://forum.javaeye.com/viewtopic.php?t=17912§Ö÷µÄÎÊÌâÎʵĺ¬º¬ºýºý:flyjie¸ø³öÁ˷dz£ÏêϸµÄ½âÊÍ£¬²»¹ý¾ÍÊÇûÓнâÊÍStringʵÀý»¯µÄÌØÊâ·½ÃæÒÔ¼°Intern()·½·¨µÄº¬Òå----------------------------------------------------------------------------------------------------------------------------------------- ......
´ó¼ÒºÃ£¬Çë°´ÕÕÏÂͼ¸ñʽÌîдÄãµÄ¼òÀú£¬·¢Ë͵½Óʼþ loveyingjiaping@126.com
¹«Ë¾×ܲ¿ÔÚº¼ÖÝÎ÷ºþ¿Æ¼¼Ô°¸½½ü£¬¸£Àû´ýÓöºÃ£¬ÎåÏÕÒ»½ð£¬
²¹Ìù£º·¹Ìù¡¢½»Í¨·Ñ¡¢Í¨Ñ¶·Ñ¡¢ÄêÖÕ½±¡¢¹ý½Ú·Ñ……
±±¾©·Ö¹«Ë¾¼¼Êõ²¿¾Àí£¨¸±¾Àí£©¸ÚλְÔðºÍÈÎÖ°Ìõ¼þÈçÏ£º
n ¸ÚλְÔð£º
1. & ......