Hi. Ok, I am new, and I'm sure my question is very basic, but I want to learn RoR and if I don't understand something in detail it bugs the heck out of me. So hopefully someone can help.

I'm going through the Sitepoint book and come to this example:
class Car
@@number_of_cars = 0
def self.count
@@number_of_cars
end
def initialize
@@number_of_cars += 1
end
end

I created 4 car objects and then did a Car.count and got 4, so it works as advertised, but I have two questions.

1. with the line of code @@number_of_cars = 0, why isn't that variable getting reset to 0 each time I instantiate a new car object? It seems to me it would, but obviously it isn't. Which is a good thing, but I don't udnerstand why it isn't resetting the variable to 0 with each new instance.

2. I assume it is just 'convention' and the name 'initialize' that makes that method run each time a new instance of the object is created. Correct?

Thanks.