Encountring error while implementing functions in abstract class

I have an abstract class A
which has the following functions :
1) private B()
2) abstract C()

Now when i create an object of this class somewhere else like :
A a = new A()
//i am unable to access private functions and variables from here

The issue i am encountring is that why i am unable to call private methods or access private variables from inside the functions ? why does java not allow this .. it seems bit odd to me.. Please explain..
Also whats the solution if i want to access a fucntion

Rohit BajajAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Now when i create an object of this class somewhere else like :

You're not actually. You're creating an object from a subclass of A. If you want to override and invoke its methods irrespective of package location, you need to mark the methods of the base class with the modifier protected or public
Rohit BajajAuthor Commented:
If i am creating an object from a subclass of A then how is it represented. I mean there is one way in which
i can explicity define a class  X implementing the Abstract class A. This will have a name etc. and I know i have created an object of type X whereas in above case what is the class whose object is created there is no name specified.
To be more precise still, what you've done is created an object, the type of which is an anonymous subclass of A and assigned it to a reference of type A

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial

Personally i avoid anonymous classes - they militate against self-documenting code and produce nastily named binaries which can be more easily overlooked when moved around
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.