java - 错误: no enclosing instance of type BPN is in scope {

标签 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 行)

最佳答案

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

关于java - 错误: no enclosing instance of type BPN is in scope {,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8028705/

相关文章:

java - 为什么迭代器不强制 hasext 调用?

java - Java无限循环

java - 如何在 Eclipse 中使用 Maven 进行构建

java - 字符串java正则表达式中的多个反斜杠

java - Thymeleaf 中嵌套循环项的连续计数

java - camera.setPreviewDisplay(SurfaceHolder) 上的异常

java - 从 Maven 获取 ${basedir} 的父目录

JavaFX 文本在高 DPI 上无法正确缩放

java - 测试期间的 Spring Boot JPA 事务 - 在插入时不抛出关键违规异常

Java Fibonacci for 循环变量