posted 14 years ago
Compilation error, in package trunk2 at line 2
Compilation error, in package trunk3 at line 4.
These 2 are correct answers...
Reason:
Constructor can be default. So option 3 is not wrong. Anything declared as default has access in that package only. Not even in the subclasses out of package(protected members have this property). In package trunk2, when you try to extend some class from package trunk1, compiler will complain as that class has default constructor. And as I said above, you cannot access anything that has default tag, outside the package, even if you extend the class from first package.
I hope this point is clear to you.
Now, a line in Tester file:
Account c = new Account();
This line is trying to do same as we discussed above. Accessing default members outside package. Compiler won't allow it.
If you still have any doubt, please ask for the same.
Regards,
Abhishek.