Forums Register Login

accessing private member of super class in subclass in java

+Pie Number of slices to send: Send
i got the problem to accessing the private member or method of super class
in subclass in java you can not access it but using some reflection or disable to security manager we can do that.
but i am not getting how to do this please tell me solution for that

thanks
+Pie Number of slices to send: Send
Why cant you use a proctected scope ?
+Pie Number of slices to send: Send

[ November 09, 2004: Message edited by: Pradeep Bhat ]
+Pie Number of slices to send: Send
Replace PrivateField with your private filed member avar.

Please post in public forum rather than sending PM to me.
+Pie Number of slices to send: Send
hi...

dear pl...tell me how can i access all private member from super class in sub class

with the help of this code u can access only specific variable
but i want to store all private instance variable in Field [] array then i want to use them

pl.. solve the problem
+Pie Number of slices to send: Send
hi...

dear pl...tell me how can i access all private member from super class in sub class
=============
Field field = class.getDeclaredField("avar");
field.setAccessible(true);
System.out.println("*******Private String :" + field.get(obj))
==============
with the help of above code u can access only specific variable
but i want to store all private instance variable in Field [] array then i want to use them

pl.. solve the problem
+Pie Number of slices to send: Send


Eliminate 95% of the weeds in your lawn by mowing 3 inches or higher. Then plant tiny ads:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2202 times.
Similar Threads
Can abstract class has static member?
some questions
A doubt about Protected Member
Constructor
Protected
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 23:30:35.