There are 2 classes . Class A and Class B. In Class A i declared
a variable in private. if we can access this private variable in
Class B. If yes means , how we can access ?
Answers were Sorted based on User's Feedback
Answer / sree
if the variable is private.Declare setter and getters to
the variable and access the varible using the setter and
getters in the other class
Is This Answer Correct ? | 34 Yes | 1 No |
Answer / anant
The variable declared in class a should be directed available
in inner class because.
Getter and setter is also another way.
Is This Answer Correct ? | 11 Yes | 1 No |
Answer / sudhakar
private variables are not accessible by the subclasses, either the class B should be the inner class of class A or we have to go through the java reflection api.
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / deepak sarao
with the help of friend function u can access private of
class A in class B
Is This Answer Correct ? | 5 Yes | 19 No |
Answer / anup
we can easily use of private variable of class A by class B
by inherits by extends keywords as a publicly.then every
variable which are present in base class as behave in derive
class.
Is This Answer Correct ? | 1 Yes | 25 No |
How many types of modules is defined by j2ee specification?
What is java ee server?
What is business logic?
What is java advanced?
What is the use of jit compiler in java?
What is credentials?
What is certificate authority?
What do you mean by j2ee module?
What is business method?
What is layout in java?
What is a panel java?
Hi Friends. I want complete technical flow of j2ee project with following technologies. jsp , servlet , Struts , Hibernate , (should follow mvc-2 design pattern) . with DAO ,DTO SERVICE layers .