Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to call InnerClass method...Help..Urgent

 
sam patel
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How can i call a setName() method of the Inner class in below code.
Any help will be greatly appreciated.
Thanks.
public class EnclosingClass{
public class InnerClass{
private String name;
public String getName(){
return name;
}

public void setName(String name){
this.name = name;
}
}
}
 
sam patel
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured it out!
EnclosingClass ec = new EnclosingClass();
EnclosingClass.InnerClass ei = ec.new InnerClass();
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic