Patrick Zesar wrote:
>>     class Sup
>>      @@x = "A"
>>      def test
>>       print @@x
>>      end
>>     end
>>
>>     class Sub1 < Sup
>>      @@x = "B"
>>     end
>>
>>     class Sub2 < Sup
>>      @@x = "C"
>>     end
>>
>>     Sup.new.test
>>     Sub1.new.test
>>     Sub2.new.test
>>
>>
>> I expect this to print "ABC", and yet it prints "CCC". Why is this?
>
>[...] 
> and - am i right? - in java it would say ABC, wouldn't it?

No, in Java this kind of source couldn't be implemented.
In Java you can't define a class variable which was already
defined by the super class (same with instance variables,
of course).

However, you can reassign them. But even this can't be done
that way, i.e. in the class definition. The "<mainclass>.Main(args)"
may be a place to do that. There are also some ugly hacks
possible to execute some code when the class is loaded, ...

but nevertheless, you can't *redefine* a class variable
in Java. You can just *reassign* them. And that's exactly
what Ruby did, too.  :-)

-- 
Volker Grabsch
---<<(())>>---
\frac{\left|\vartheta_0\times\{\ell,\kappa\in\Re\}\right|}{\sqrt
[G]{-\Gamma(\alpha)\cdot\mathcal{B}^{\left[\oint\!c_\hbar\right]}}}