Today I have given a code
public class A
{
class B b;
}
public class B
{
class A a;
}
and he asked is there any error??
I told him we can't place two public classes in a single source file..He said no it is possible.
then he changes the code as
public class A
{
class B b; // line no1
}
protected class B
{
class A a; // line no2
}
then I said line no1 n line no2 has error.
He was not satisfied, I said this forward declaration is allowed in c++ not in
java..
Then at the end of the interview I again said him that its not possible...
he said it is possible either he was joking or I am mad or may be I don't know much....
Please suggest some thing...