错误:没有封闭的BPN类型实例在范围内{

时间:2011-11-06 17:03:15

标签: java

class BPN {
public class BackpropagationNet extends NeuralNet
{
    Vector neuronLayerVector;
    NeuronLayer[] neuronLayerArray;
    //...
    public BackpropagationNet()
    {
        this.learningCycle = 0;
        this.maxLearningCycles = -1;
        //....
        resetTime();
    }
    //some functions
    void addNeuronLayer(int paramInt)
    {//....     }
    void connectLayers()
    {//....}

}
abstract class NeuralNet
{   
    final int PATTERN_LENGTH = 100;
    final int PATTERN_VALUE = 101;
    final int PATTERNFILE_LENGTH = 102;
    final int GENERAL_IO = 104;
    //....

}
static BackpropagationNet bpn;  

public static void main ( String[] args ) {
   // some logic...
    bpn = new BackpropagationNet();
        //...
    }
}

嗯,这是一个应该证明问题的简短程序。 当我尝试编译时收到此错误: 没有封闭的BPN类型实例在范围{(第9行)

1 个答案:

答案 0 :(得分:1)

从类中删除static关键字,顶级类不能声明为静态类。