Java½â»ó2 28Ñ»·Õß
ÏÂÃæµÄÃÕÌâÒÔ¼°ËæºóµÄÎå¸öÃÕÌâ¶ÔÄãÀ´ËµÊÇŤתÁ˾ÖÃ棬ËüÃDz»ÊÇÏòÄãչʾijЩ´úÂ룬ȻºóѯÎÊÄãÕâЩ´úÂ뽫×öЩʲô£¬ËüÃÇÒªÈÃÄãȥд´úÂ룬µ«ÊÇÊýÁ¿»áºÜÉÙ¡£ÕâЩÃÕÌâ±»³ÆΪ“Ñ»·Õߣ¨looper£©”¡£ÄãÑÛÇ°»áչʾ³öÒ»¸öÑ»·£¬Ëü¿´ÆðÀ´Ó¦¸ÃºÜ¿ì¾ÍÖÕÖ¹µÄ£¬¶øÄãµÄÈÎÎñ¾ÍÊÇдһ¸ö±äÁ¿ÉùÃ÷£¬ÔÚ½«Ëü×÷ÓÃÓÚ¸ÃÑ»·Ö®ÉÏʱ£¬Ê¹µÃ¸ÃÑ»·ÎÞÏÞÑ»·ÏÂÈ¥¡£ÀýÈ磬¿¼ÂÇÏÂÃæµÄforÑ»·£º
for (int i = start; i <= start + 1; i++) {}
¿´ÆðÀ´ËüºÃÏñÓ¦¸ÃÖ»µü´úÁ½´Î£¬µ«ÊÇͨ¹ýÀûÓÃÔÚÃÕÌâ26ÖÐËùչʾµÄÒç³öÐÐΪ£¬¿ÉÒÔʹËüÎÞÏÞÑ»·ÏÂÈ¥¡£ÏÂÃæµÄµÄÉùÃ÷¾Í²ÉÓÃÁËÕâÏî¼¼ÇÉ£º
int start = Integer.MAX_VALUE - 1;
ÏÖÔÚ¸ÃÂÖµ½ÄãÁË¡£Ê²Ã´ÑùµÄÉùÃ÷Äܹ»ÈÃÏÂÃæµÄÑ»·±ä³ÉÒ»¸öÎÞÏÞÑ»·£¿
While (i == i + 1) {}
×Ðϸ²é¿´Õâ¸öwhileÑ»·£¬ËüÕæµÄºÃÏñÓ¦¸ÃÁ¢¼´ÖÕÖ¹¡£Ò»¸öÊý×ÖÓÀÔ¶²»»áµÈÓÚËü×Ô¼º¼Ó1£¬¶ÔÂð£¿àÅ£¬Èç¹ûÕâ¸öÊý×ÖÊÇÎÞÇî´óµÄ£¬ÓÖ»áÔõÑùÄØ£¿JavaÇ¿ÖÆÒªÇóʹÓÃIEEE 754¸¡µãÊýËãÊõÔËËã[IEEE 754]£¬Ëü¿ÉÒÔÈÃÄãÓÃÒ»¸ödouble»òfloatÀ´±íʾÎÞÇî´ó¡£ÕýÈçÎÒÃÇÔÚѧУÀïÃæѧµ½µÄ£¬ÎÞÇî´ó¼Ó1»¹ÊÇÎÞÇî´ó¡£Èç¹ûiÔÚÑ»·¿ªÊ¼Ö®Ç°±»³õʼ»¯ÎªÎÞÇî´ó£¬ÄÇôÖÕÖ¹Ìõ¼þ²âÊÔ(i == i + 1)¾Í»á±»¼ÆËãΪtrue£¬´Ó¶øʹѻ·ÓÀÔ¶¶¼²»»áÖÕÖ¹¡£
Äã¿ÉÒÔÓÃÈκα»¼ÆËãΪÎÞÇî´óµÄ¸¡µãËãÊõ±í´ïʽÀ´³õʼ»¯i£¬ÀýÈ磺
double i = 1.0 / 0.0;
²»¹ý£¬Äã×îºÃÊÇÄܹ»ÀûÓñê×¼Àà¿âΪÄãÌṩµÄ³£Á¿£º
double i = Double.POSITIVE_INFINITY;
ÊÂʵÉÏ£¬Äã²»±Ø½«i³õʼ»¯ÎªÎÞÇî´óÒÔÈ·±£Ñ»·ÓÀÔ¶Ö´ÐС£ÈκÎ×ã¹»´óµÄ¸¡µãÊý¶¼¿ÉÒÔʵÏÖÕâһĿµÄ£¬ÀýÈ磺
double i = 1.0e40;
ÕâÑù×öÖ®ËùÒÔ¿ÉÒÔÆð×÷Óã¬ÊÇÒòΪһ¸ö¸¡µãÊýÖµÔ½´ó£¬ËüºÍÆäºó¼ÌÊýÖµÖ®¼äµÄ¼ä¸ô¾ÍÔ½´ó¡£¸¡µãÊýµÄÕâÖÖ·Ö²¼ÊÇÓù̶¨ÊýÁ¿µÄÓÐЧλÀ´±íʾËüÃǵıØÈ»½á¹û¡£¶ÔÒ»¸ö×ã¹»´óµÄ¸¡µãÊý¼Ó1²»»á¸Ä±äËüµÄÖµ£¬ÒòΪ1ÊDz»×ãÒÔ“Ìî²¹ËüÓëÆäºó¼ÌÕßÖ®¼äµÄ¿Õ϶”¡£
¸¡µãÊý²Ù×÷·µ»ØµÄÊÇ×î½Ó½üÆ侫ȷµÄÊýѧ½á¹ûµÄ¸¡µãÊýÖµ¡£Ò»µ©ÅþÁڵĸ¡µãÊýÖµÖ®¼äµÄ¾àÀë´óÓÚ2£¬ÄÇô¶ÔÆäÖеÄÒ»¸ö¸¡µãÊýÖµ¼Ó1½«²»»á²úÉúÈκÎЧ¹û£¬ÒòΪÆä½á¹ûûÓдﵽÁ½¸öÊýÖµÖ®¼äµÄÒ»°ë¡£¶ÔÓÚfloatÀàÐÍ£¬¼Ó1²»»á²úÉúÈκÎЧ¹ûµÄ×îС¼¶ÊýÊÇ225£¬¼´33,554,432£»¶ø¶ÔÓÚdoubleÀàÐÍ£¬×îС¼¶ÊýÊÇ254£¬´óÔ¼ÊÇ1.8 × 1016¡£
ÅþÁڵĸ¡µãÊýÖµÖ®¼äµÄ¾àÀë±»³ÆΪһ¸öulp£¬ËüÊÇ“×îСµ¥Î»£¨unit in the last place£©”µÄÊ××ÖĸËõд´Ê¡£ÔÚ5.0°æÖУ¬ÒýÈëÁËMath.ulp·½·¨À´¼ÆËãfloat»òdoubleÊýÖµµÄ
Ïà¹ØÎĵµ£º
ListµÄÓ÷¨
List°üÀ¨List½Ó¿ÚÒÔ¼°List½Ó¿ÚµÄËùÓÐʵÏÖÀà¡£ÒòΪList½Ó¿ÚʵÏÖÁËCollection½Ó¿Ú£¬ËùÒÔList½Ó¿ÚÓµÓÐCollection½Ó¿ÚÌṩµÄËùÓг£Ó÷½·¨£¬ÓÖÒòΪListÊÇÁбíÀàÐÍ£¬ËùÒÔList½Ó¿Ú»¹ÌṩÁËһЩÊʺÏÓÚ×ÔÉíµÄ³£Ó÷½·¨£¬Èç±í1Ëùʾ¡£
±í1 List½Ó¿Ú¶¨ÒåµÄ³£Ó÷½·¨¼°¹¦ÄÜ
´Ó±í1¿ÉÒÔ¿´³ö£¬List½Ó¿ÚÌṩµÄÊʺÏÓÚ×ÔÉíµÄ ......
......
1¡¢Óï·¨£º±ØÐë±È½ÏÊìϤ£¬ÔÚд´úÂëµÄʱºòIDEµÄ±à¼Æ÷¶ÔijһÐб¨´íÓ¦¸ÃÄܹ»¸ù¾Ý±¨´íÐÅÏ¢ÖªµÀÊÇʲôÑùµÄÓï·¨´íÎó²¢ÇÒÖªµÀÈκÎÐÞÕý¡£
2¡¢ÃüÁ±ØÐëÊìϤJDK´øµÄһЩ³£ÓÃÃüÁî¼°Æä³£ÓÃÑ¡ÏÃüÁîÖÁÉÙÐèÒªÊìϤ£ºappletviewer¡¢ HtmlConverter¡¢jar¡¢ java¡¢javac¡¢javadoc¡¢javap¡¢javaw¡¢native2ascii¡¢serialver£¬Èç¹ûÕâЩÃüÁ ......
ÏÂÃæµÄ³ÌÐò¶ÔÒ»¸ö±äÁ¿Öظ´µØ½øÐÐÔöÁ¿²Ù×÷£¬È»ºó´òÓ¡ËüµÄÖµ¡£ÄÇôÕâ¸öÖµÊÇʲôÄØ£¿
public class Increment {
public static void main(String[] args) {
int j = 0;
for (int i = 0; i < 100; i++)
j = j++;
System.out.println(j);
}
}
Õ§Ò»¿´£¬Õâ¸ö³ÌÐò¿ÉÄÜ» ......