I am having some problem with a piece of code I was writing. I have 2 classes, both in the same package. I will name them as class A and class B, neither is a subclass of the other.
I have the following code in class B:
I am getting an error for this line: a.doGet(); doGet is actually a protected method from class A. The error message is as follows:
I am wondering why I am getting this error since I am accessing the protected method doGet( ) via an instance of the A class. Will appreciate if someone can explain to me why I am getting this error. Thanks.
I think I have figured it out. A very careless mistake on my part. The said method in class A has parameters and I should have passed arguments to it when I am trying to access it via an instance of class A, sadly I had failed to do it and that caused the problem. Thanks.