I have attended a job interview. The interviewer asked me why you need private variable. If you achieve something by defining a variable private, can't you achieve the same by defining any other access modifier defined in java?
According to Java Specification Languages, A private class member or constructor is accessible only within the body of the top level class (7.6) that encloses the declaration of the member or constructor. It is not inherited by subclasses.
But, if i am designing a class, how can i take decision to define a variable "private"?