Search:

Type: Posts; User: pbrockway2

Search: Search took 0.10 seconds.

  1. Replies
    11
    Views
    1,908

    Re: Nested classes.

    You read these stack traces from the top down, paying special attention to the first line that mentions your code because this is where the exception occurred.

    Line 34 of DataStructure.java is...
  2. Replies
    11
    Views
    1,908

    Re: Nested classes.

    Please say what the exception is. It is a good idea to post the entire stack trace because this also says on what line of your code the exception occurred.

    -----

    Once you have added that line...
  3. Replies
    11
    Views
    1,908

    Re: Nested classes.

    What is the code? What was the exception?

    (If the code is long remove anything that is not essential to illustrating the problem).

    The following accesses and prints the values fine:


    ...
  4. Replies
    11
    Views
    1,908

    Re: Nested classes.

    1) Yes, you can't have two nested Bar classes. But you *can* have two Bar classes one nested, one not in the same package with the compiler doing a little name mangling to keep things straight. It...
  5. Replies
    11
    Views
    1,908

    Re: Nested classes.

    I can't see any reason why there shouldn't be multiple classes: the full name of a type includes the packages and enclosing classes.

    For instance the following compiles just fine:



    ...
  6. Replies
    11
    Views
    1,908

    Re: Nested classes.

    As with "this" and variables it can be dropped if there is no confusion.



    int foo;
    void setFoo(int foo) {
    this.foo = foo;
    }
Results 1 to 6 of 6