This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Please UseCodeTags next time. I've added them this time.
Because Beta.bar overrides Alpha.bar, both calls to a.bar("test") and b.bar('test") call Beta.bar. This behaviour is called polymorphism.
Beta.foo has a different signature from Alpha.foo. In class Alpha, the only method foo that takes a String is foo(String...). Because with a.foo("test") the reference type is Alpha the compiler does not know that the object is actually a Beta instance and also has foo(String). Therefore, it calls the only method it knows: foo(String...) which prints "Alpha:foo ".
In class Beta there are two methods called foo -- foo(String...) which is inherited from class Alpha and foo(String) which is newly declared. With b.foo("test") the reference type is Beta so the compiler finds both methods. In this case the most specific method is chosen. Methods with varargs are always the last choice so that's why foo(String) is chosen, and "Beta:foo " is printed.