JAVA¼¸¸ö³£¼û´íÎó¼òÎö
1£¬¿ÕÖ¸Õë´íÎó java.lang.NullPointerException
ʹÓûù±¾µÄJAVAÊý¾ÝÀàÐÍ£¬±äÁ¿µÄֵҪôÒѾÊÇĬÈÏÖµ£¬Èç¹ûûÓжÔÆäÕý³£¸³Öµ£¬³ÌÐò±ã²»ÄÜͨ¹ý±àÒ룬Òò´ËʹÓûù±¾µÄJAVAÊý¾ÝÀàÐÍ
(double,float,boolean,char,int,long)Ò»°ã²»»áÒýÆð¿ÕÖ¸ÕëÒì³£¡£Óɴ˿ɼû£¬¿ÕÖ¸ÕëÒì³£Ö÷Òª¸úÓë¶ÔÏóµÄ²Ù×÷Ïà¹Ø¡£
ÏÂÃæÏÈÁгöÁË¿ÉÄÜ·¢Éú¿ÕÖ¸ÕëÒì³£µÄ¼¸ÖÖÇé¿ö¼°ÏàÓ¦½â¾ö·½°¸£º
²»¹Ü¶ÔÏóÊÇ·ñΪ¿Õ¾ÍÖ±½Ó¿ªÊ¼Ê¹Óá£
(JSP)´úÂë¶Î1£º
out.println(request.getParameter("username"));
ÃèÊö£º
´úÂë¶Î1µÄ¹¦ÄÜÊ®·Ö¼òµ¥£¬¾ÍÊÇÊä³öÓû§ÊäÈëµÄ±íÓò"username"µÄÖµ¡£
˵Ã÷£º
¿´ÉÏÈ¥£¬ÉÏÃæµÄÓï¾äÕÒ²»³öʲôÓï·¨´íÎ󣬶øÇÒÔÚ´ó¶àÊýÇé¿öÏÂÒ²Óö²»µ½Ê²Ã´ÎÊÌâ¡£µ«ÊÇ£¬Èç¹ûij¸öÓû§ÔÚÊäÈëÊý¾Ýʱ²¢Ã»ÓÐÌṩ±íµ¥
Óò"username"µÄÖµ£¬»òͨ¹ýijÖÖ;¾¶Èƹý±íµ¥Ö±½ÓÊäÈëʱ£¬´Ëʱrequest.getParameter("username")µÄֵΪ¿Õ£¨²»ÊÇ
¿Õ×Ö·û´®£¬ÊÇ¿Õ¶ÔÏónull¡££©£¬out¶ÔÏóµÄprintln·½·¨ÊÇÎÞ·¨Ö±½Ó¶Ô¿Õ¶ÔÏó²Ù×÷£¬Òò´Ë´úÂë¶Î1ËùÔÚµÄJSPÒ³Ã潫»áÅ×
³ö"java.lang.NullPointerException"Òì³£¡£
¼´Ê¹¶ÔÏó¿ÉÄÜΪ¿Õʱ£¬Ò²µ÷ÓÃjava.lang.Object»òObject¶ÔÏó±¾ÉíµÄһЩ·½·¨ÈçtoString(), equals(Object obj)µÈ²Ù×÷¡£
(JSP)´úÂë¶Î2£º
String userName = request.getParameter("username");
If (userName.equals("root"))
{....}
ÃèÊö£º
´úÂë¶Î2µÄ¹¦ÄÜÊǼì²âÓû§ÌṩµÄÓû§Ãû£¬Èç¹ûÊÇÓû§Ãû³ÆΪ"root"µÄÓû§Ê±£¬¾ÍÖ´ÐÐһЩÌرðµÄ²Ù×÷¡£
˵Ã÷£º
ÔÚ´úÂë¶Î2ÖУ¬Èç¹ûÓÐÓû§Ã»ÓÐÌṩ±íµ¥Óò"username"µÄֵʱ£¬×Ö·û´®¶ÔÏóuserNameΪnullÖµ£¬²»Äܹ»½«Ò»¸önullµÄ¶ÔÏóÓëÁí
Ò»¸ö¶ÔÏóÖ±½Ó±È½Ï£¬Í¬Ñù£¬´úÂë¶Î2ËùÔÚµÄJSPÒ³Ãæ¾Í»áÅ׳ö(java.lang.NullPointerException)¿ÕÖ¸Õë´íÎó¡£
(JSP)´úÂë¶Î3£º
String userName = session.getAttribute("session.username").toString();
ÃèÊö£º
´úÂë¶Î3µÄ¹¦ÄÜÊǽ«sessionÖÐsession.usernameµÄֵȡ³ö£¬²¢½«¸ÃÖµ¸³¸ø×Ö·û´®¶ÔÏó userName¡£
˵Ã÷£º
ÔÚÒ»°ãÇé¿öÏ£¬Èç¹ûÔÚÓû§ÒѾ½øÐÐij¸ö»á»°£¬Ôò²»»á³öÏÖʲôÎÊÌ⣻µ«ÊÇ£¬Èç¹û´ËʱӦÓ÷þÎñÆ÷ÖØÐÂÆô¶¯£¬¶øÓû§»¹Ã»ÓÐÖØеǼ£¬£¨Ò²¿ÉÄÜÊÇÓû§¹Ø±Õ
ä¯ÀÀÆ÷£¬µ«ÊÇÈÔ´ò¿ªÔÀ´µÄÒ³Ãæ¡££©ÄÇô£¬´Ëʱ¸ÃsessionµÄÖµ¾Í»áʧЧ£¬Í¬Ê±µ¼ÖÂsessionÖеÄsession.usernameµÄֵΪ¿Õ¡£¶ÔÒ»
¸öΪnullµÄ¶ÔÏóµÄ
Ïà¹ØÎĵµ£º
1.ÕûÊý
byte 1×Ö½Ú
short 2×Ö½Ú
int 4×Ö½Ú
long 8×Ö½Ú
2.¸¡µã
float
double
Ìáʾ
£¨1£© ¸¡µãÐ͵ÄÖµ£¬Èç¹ûûÓÐÌرðÖ¸Ã÷£¬Ä¬ÈÏÊÇ double Ð͵Ä
£¨2£© ¶¨Òå float Ð͵Äʱºò£¬Ò»¶¨ÒªÖ¸Ã÷ÊÇ float Ð͵ģ¬¿ÉÒÔͨ¹ýÔÚÊý×ÖºóÃæÌí¼Ó&rd ......
¸ÄÒ»¸öÕâÑùµÄÌâÄ¿Õýʽ¸æËßÄ㣬ÎÒÖÕÓÚ¶¯ÊּǼһЩjavaµÄ±Ê¼ÇÁË¡£ÊµÔںܾÃûÓÐдjavaÁË¡£¹þ¹þ£¬²»ºÃÒâ˼£¬ÎªÁËflash ºǫ́ÓиöÖ§³Ö£¬java Õⲿ·Ö»¹ÊÇҪѧһµã£¬µ«²»ÊǺÜÖصãѧ¡£Õⲿ·Ö¶«Î÷£¬ÎÒ²»ÊìϤ£¬Ò²ÔÚÂýÂý¼Ç¼¡£×Ô¼º¿´µÄ±Ê¼Ç£¬ËùÒÔÒªÊÇÄã²»ÊÇɵB£¬×îºÃ²»Òª¿´¡£
ÔÚ½ñÍíÁ·Ï°µÄʱºò£¬³¢ÊÔÈ¥Á¬½Ó¿É°®µÄ ......
JAVAÓïÑÔÖеķ´Éä»úÖÆ£º
ÔÚJava ÔËÐÐʱ »·¾³ÖУ¬¶ÔÓÚÈÎÒâÒ»¸öÀ࣬ÄÜ·ñÖªµÀÕâ¸öÀàÓÐÄÄЩÊôÐԺͷ½·¨£¿
¶ÔÓÚÈÎÒâÒ»¸ö¶ÔÏó£¬ÄÜ·ñµ÷ÓÃËûµÄ·½·¨£¿ÕâЩ´ð°¸Êǿ϶¨µÄ£¬ÕâÖÖ¶¯Ì¬»ñÈ¡ÀàµÄÐÅÏ¢£¬ÒÔ¼°¶¯Ì¬µ÷ÓÃÀàµÄ·½·¨µÄ¹¦ÄÜÀ´Ô´ÓÚJAVAµÄ·´Éä¡£´Ó¶øʹjava¾ßÓж¯Ì¬ÓïÑÔµÄÌØÐÔ¡£
JAVA·´É ......
JavaÓïÑÔ»ù´¡ÖªÊ¶
³ÌÐòÔ±¶Ô³ÌÐòÖеĸ÷¸öÔªËؼÓÒÔÃüÃûʱʹÓõÄÃüÃû¼ÇºÅ³ÆΪ±êʶ·û£¨identifier£©¡£
JavaÓïÑÔÖУ¬±êʶ·ûÊÇÒÔ×Öĸ£¬Ï»®Ïߣ¨_£©,ÃÀÔª·û($)¿ªÊ¼µÄÒ»¸ö×Ö·ûÐòÁУ¬ºóÃæ¿ÉÒÔ¸ú×Öĸ£¬Ï»®Ïߣ¬ÃÀÔª·û£¬Êý×Ö¡£
ÀýÈ磬identifier£¬userName£¬User_Name£¬_sys_val£¬ $changeΪºÏ·¨µÄ±êʶ·û£¬¶ø2mail room#£¬class Ϊ· ......
String[] ips = ipValue.split("\\.");
String binaryVal = "";
for (int i = 0; i < ips.length; i++)
{
String binaryStr = Integer.toBinaryString(Integer.parseInt(ips[i]));
Integer times = 8 - binaryStr.length();
......