I want to access private member of a class by anonymous class created in a different class. I am new to java, kindly please explain this and tell what i am doing wrong.
class movie{
private String moviename="bahubali";
void display(){
System.out.println(moviename);
}
}
public class InnerClass{ //main class
public static void main(String[] args) {
movie anonymous=new movie() {
void display() {
System.out.println(moviename+" in anonymous class");
}
};
anonymous.display();
}
}