Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
What is the result of attempting to compile and run this code? interface A{ void aMethod(); } public class Test implements A{ void aMethod(){ System.out.println("hello"); } public static void main(String[] args){ Test t = new Test(); t.aMethod(); } } This is the answer given: Will fail compilation becuse the access modifier for aMethod() is being made more restrictive. WHY???
Because methods in interface are implicitly public, but they don't necessarily use 'public'. So the overriding methods must declare as 'public'. [ October 30, 2002: Message edited by: Yan Bai ]