Forums Register Login

How to invoke the static class using classloader.

+Pie Number of slices to send: Send
hi,

I'm having two class class A and Class B.
Class A is static and in class B i'm trying to invoke the method of class A.
I'm getting following error.

java.lang.IllegalAccessException: Class com.infy.cis.fiservices.B can not access a member of class com.infy.cis.srmbo.A with modifiers "private"

But all the methods in class A and Class B are public only.

Note : In My class A default constuctor is private.

could you please help me one this issue.

with regards,
Viswanathan Ramasamy.
+Pie Number of slices to send: Send
Could you post your code? Its hard to help without seeing what you have done.

Also, this is not really an advanced question, so I'm moving it.
+Pie Number of slices to send: Send
If the constructor in class a is private then it can only be accessed within that class. So it should be public or protected.
+Pie Number of slices to send: Send
 

Originally posted by Stephen Foy:
If the constructor in class a is private then it can only be accessed within that class. So it should be public or protected.



Well, but you don't need to call the constructor to invoke a static method - the private constructor shouldn't have any effect on that.
Remember to always leap before you look. But always take the time to smell the tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 773 times.
Similar Threads
Why private modifier can't use in top class
Overriding
does static methods inherit ? what about private ?
I am really confused regarding overriding
overriding question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 20:09:40.