0
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();
        //...
    }
}

Well, this is short program which should demonstrate the problem. When i try to compile i receive this error: no enclosing instance of type BPN is in scope {(line 9)

flux
  • 1
  • 1
  • 2
    What do you mean by "after BackpropagationNet"? Which line? What class is this nested in? Could you show a short but *complete* program which demonstrates the problem? – Jon Skeet Nov 06 '11 at 17:05
  • thisi is how the program starts public class BPN { static BackpropagationNet bpn; public static class BackpropagationNet extends NeuralNet {... – flux Nov 06 '11 at 17:10
  • 1
    "how the program starts" is not the same as a short but complete program demonstrating the problem. We don't need to see all the logic - just a program which shows the same problem, but is complete. – Jon Skeet Nov 06 '11 at 17:15
  • You still don't seem to get it. Anything showing just how something *starts* is unlikely to be complete. But don't put this into comments anyway - edit the question. See http://tinyurl.com/so-hints for more details. – Jon Skeet Nov 06 '11 at 17:21
  • Possible duplicate of [Java - No enclosing instance of type Foo is accessible](http://stackoverflow.com/questions/9560600/java-no-enclosing-instance-of-type-foo-is-accessible) – fabian Mar 03 '16 at 23:15

1 Answers1

1

remove static keyword from the class, top-level class cannot declared as static class.

Wajdy Essam
  • 4,280
  • 3
  • 28
  • 33