当前位置: 首页 > news >正文

网站建设开发免费咨询做代理稳妥的彩票网站有哪些

网站建设开发免费咨询,做代理稳妥的彩票网站有哪些,临沂网站制作企业,搜索引擎广告名词解释今天调试程序时,在调用Properties类的setProperty(String key, String value)方法时,遇到了一个小问题,程序运行到该语句时抛出异常,提示java.lang.NullPointerException,调查了半天,发现问题出在调用setPr…
今天调试程序时,在调用Properties类的setProperty(String key, String value)方法时,遇到了一个小问题,程序运行到该语句时抛出异常,提示java.lang.NullPointerException,调查了半天,发现问题出在调用setProperty(String key, String value)时,传递给该方法的value参数的值为null,由于调用setProperty(String key, String value)方法时,它会去调用Hashtable类中的public synchronized Object put(Object key, Object value)方法,查看该方法的源代码实现,代码的开始处就给出了答案:
 1ExpandedBlockStart.gifContractedBlock.gifpublic synchronized Object put(Object key, Object value)  {
 2InBlock.gif    // Make sure the value is not null

 3ExpandedSubBlockStart.gifContractedSubBlock.gif    if (value == null{
 4InBlock.gif        throw new
 NullPointerException();
 5ExpandedSubBlockEnd.gif    }

 6InBlock.gif
 7InBlock.gif    // Makes sure the key is not already in the hashtable.

 8InBlock.gif    Entry tab[] = table;
 9InBlock.gif    int hash =
 key.hashCode();
10InBlock.gif    int index = (hash & 0x7FFFFFFF%
 tab.length;
11ExpandedSubBlockStart.gifContractedSubBlock.gif    for (Entry e = tab[index] ; e != null ; e = e.next) 
{
12ExpandedSubBlockStart.gifContractedSubBlock.gif        if ((e.hash == hash) && e.key.equals(key)) 
{
13InBlock.gif        Object old =
 e.value;
14InBlock.gif        e.value =
 value;
15InBlock.gif        return
 old;
16ExpandedSubBlockEnd.gif        }

17ExpandedSubBlockEnd.gif    }

18InBlock.gif
19InBlock.gif    modCount++
;
20ExpandedSubBlockStart.gifContractedSubBlock.gif    if (count >= threshold) 
{
21InBlock.gif        // Rehash the table if the threshold is exceeded

22InBlock.gif        rehash();
23
InBlock.gif
24InBlock.gif            tab =
 table;
25InBlock.gif            index = (hash & 0x7FFFFFFF%
 tab.length;
26ExpandedSubBlockEnd.gif    }
 
27
InBlock.gif
28InBlock.gif    // Creates the new entry.

29InBlock.gif    Entry e = new Entry(hash, key, value, tab[index]);
30InBlock.gif    tab[index] =
 e;
31InBlock.gif    count++
;
32InBlock.gif    return null
;
33ExpandedBlockEnd.gif    }

就此,问题的根源找到了,以后写程序的时候得多注意这些细节。以下附上setProperty(String key, String value)方法的描述:
 1None.gif Object java.util.Properties.setProperty(String key, String value)
 2None.gifCalls the Hashtable method put. Provided for parallelism with the getProperty method. Enforces use of strings for
 property keys and values. The value returned is the result of the Hashtable call to put. 
 3
None.gif
 4
None.gifSee Also:
 5
None.gifgetProperty

 6
None.gifParameters:
 7None.gifkey: the key to be placed into this
 property list.
 8
None.gifvalue: the value corresponding to key.

 9
None.gifReturns:
10None.gifthe previous value of the specified key in this property list, or null if
 it did not have one.

11
None.gifSince: 1.2

转载于:https://www.cnblogs.com/xxpal/articles/837400.html

http://www.yayakq.cn/news/826672/

相关文章:

  • 如何将自己做的网站变成中文建设 网站协议
  • 个人怎么做公司网站吴江区建设局网站打不开
  • 做衣服的教程网站有哪些舆情分析是个什么行业
  • 地方网站欣赏开设购物网站的方案
  • 建立网站tk网站的切图是谁来做
  • 呼和浩特建设工程信息网站南昌市科协网站
  • 小辣椒网站开发网站用什么字体
  • 电商购物网站开发网站内容添加
  • 撸撸撸做最好的导航网站湛江制作企业网站
  • 如何查看自己做的网站大小wordpress title背景颜色
  • 大理网站开发优化设计四年级下册语文答案
  • 贸易网站建站嘉兴网站建设seo
  • 网站和软件的区别ei网站怎么兼做
  • 天津网站建设流程杭州网络公司网站建设
  • 天津河北做网站的公司排名网络营销是借助于什么营销手段
  • 导航网站好处做前端常用的网站及软件下载
  • 学 网站开发深圳物流公司招聘
  • 做一个15页的网站怎么做泰州市网站建设
  • 福安市网站建设在线制作电子印章软件
  • 广东省建设工程执业资格注册中心网站做网站排名有用吗
  • iis7.0建设网站wordpress自动网站地址
  • word用来做网站的体验营销案例
  • 长沙高升小区做汽车行业网站的网络公司论天心区网页设计天津河北做网站的公司
  • 做视频网站注意什么问题长沙新能源建站补贴
  • 权重高的博客网站宁波网站建设公司哪家好
  • 北京做网站公司哪家强网站后台开发做什么
  • wap网站seowordpress显示头像的节点
  • 做律师网站电销东莞专业网站设计平台
  • 平台型网站建设公司jquery 网站缩放
  • 个人建设网站服务器怎么解决西南交通建设集团股份有限公司网站