Search:

Type: Posts; User: KevinWorkman

Search: Search took 0.10 seconds.

  1. [SOLVED] Re: cannot referenced before super type constructr has been ca

    No problem. Glad you got it figured out!
  2. [SOLVED] Re: cannot referenced before super type constructr has been ca

    Yep! Maybe this will clear everything up:


    public class Main {

    public Main() {
    System.out.println("In super constructor.");
    }
  3. [SOLVED] Re: cannot referenced before super type constructr has been ca

    That's pretty much exactly how I look at it. That might not be technically true (depending on when you decide that an instance "exists"), but it makes sense to me.
  4. [SOLVED] Re: cannot referenced before super type constructr has been ca

    Sort of. Remember, in every constructor (that doesn't invoke another constructor like your no-args constructor does), there is an invisible call to super. So your code is really doing this:

    public...
  5. [SOLVED] Re: cannot referenced before super type constructr has been ca

    That's not my English, I just copied it from the JLS directly.

    But basically what it's saying is that you can't use an instance variable before the super constructor has been called. Which means...
  6. [SOLVED] Re: cannot referenced before super type constructr has been ca

    From the JLS: Classes

    An explicit constructor invocation statement in a constructor body may not refer to any instance variables or instance methods declared in this class or any superclass, or...
Results 1 to 6 of 6