Inheritance Comments


  • Is it ok that rocketCar is defined before Car ?

  • @calo, doesn't matter. On a computer, each class is usually defined in its own file; the Java compiler can figure it all out.

  • I see now ...I made it eventually, although to public RocketCar(), I only type formula for rocket fuel and nothing else:
    public RocketCar()

  • I can't figure out why fuel stays at 20

  • how do I make the fuel go down

  • @jack, please update your email information. If you're interested, you can sign up for membership on Learneroo to get help when learning online.

  • It is updated

  • Hello.
    I have correct output, but I changed private variables in class car to non-private.
    Is it OK ?
    my code:

  • Why, in the Student & Staff example, student1.super.toString() doesn't work? I get Error: cannot find symbol - class student1. I've created an instance of Student called student1.

  • I have:
    if(speed <= maxSpeed && rocketFuel != 0)

    But its saying it doesn't like my maxSpeed... error: maxSpeed has private access in Car
    if(speed <= maxSpeed && rocketFuel != 0)


  • Hi!
    I didn't succeed resolve it..

  • @Raz, you first need to address the compile errors. Don't call super() from within a regular method, instead call super.methodName(). And don't try accessing a Car's private fuel, RocketCar only deals with rocketFuel.

  • I'm didn't understand What am I being asked to do?

  • @Raz, I added a hint that spells it out in order.

  • my code - Didn't work:/

  • You still need to fix your accelerate method, it's not following the correct syntax. See the correct solution for how to fix it.

  • so with this line of code:
    System.out.println(i +". "+ rc);

    when we say + rc it calls the toString() method of class Car?
    can you please explain it why? should't it be something like
    +rc.toString()) ;

  • As mentioned above, Java has a built-in shortcut that calls the toString method of an object when you print it. So System.out.println(i +". "+ rc); is equivalent to System.out.println(i +". "+ rc.toString() );

  • why does super.Car() not work?

  • What method is .Car()?

Contact Us
Sign in or email us at [email protected]