Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

accessing private variable in subclass in java  RSS feed

 
saket gupta
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 through reflection

pl.. solve the problem
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!