zoukankan      html  css  js  c++  java
  • The ONE Bug记录

    http://www.cs.pitt.edu/~pdillon/one/

    其中的SWindowCentrality初始化不完整

    缺少红色部分

    public SWindowCentrality(Settings s)
        {
            if(s.contains(CENTRALITY_WINDOW_SETTING))
                CENTRALITY_TIME_WINDOW = s.getInt(CENTRALITY_WINDOW_SETTING);
            if(s.contains(COMPUTATION_INTERVAL_SETTING))
                COMPUTE_INTERVAL = s.getInt(COMPUTATION_INTERVAL_SETTING);
            this.lastGlobalComputationTime = this.lastLocalComputationTime =
                -COMPUTE_INTERVAL;

        }

    怪不得,结果奇奇怪怪的。

    但是,

    http://blog.csdn.net/lhooouuu/article/details/6047767

    其实问题就在这里,在JAVA中:
    Local variables must be initialized before they can be used.
    而在类定义中的属性若不赋予初值,则JAVA会自动赋予这个属性一个默认值,以下为类的属性的默认值表:
    数据类型                                    默认值
    boolean                                    false
    char                                           '/u0000'
    整形(byte,short,int,long)        0
    浮点型(float, double)           +0.0f或+0.0d
    参考型                                        null
    总结为一句话便是类里定义的数据成员称为属性,属性可不赋初值,若不赋初值则JAVA会按上表为其添加默认值;方法里定义的数据成员称为变量,变量在参与运算之前必须赋初值。

  • 相关阅读:
    独立使用 ecj
    公司没有 DBA,Mysql 运维自己来
    mysql安装
    常用模块
    基本数据类型
    Incorrect column name 问题解决
    mysql中date和datetime的区别
    python yield用法详解(未完成)
    mysql报错--initialize specified but the data directory has files in it. Aborting.
    python 列表解析式
  • 原文地址:https://www.cnblogs.com/growup/p/2545594.html
Copyright © 2011-2022 走看看