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



There are 2 classes . Class A and Class B. In Class A i declared a variable in private. if we can a..

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

There are 2 classes . Class A and Class B. In Class A i declared a variable in private. if we can a..

Answer / aslam

class B must be inner class of class A

Is This Answer Correct ?    31 Yes 3 No

There are 2 classes . Class A and Class B. In Class A i declared a variable in private. if we can a..

Answer / aslam

There is no freind function in java.

Is This Answer Correct ?    28 Yes 2 No

There are 2 classes . Class A and Class B. In Class A i declared a variable in private. if we can a..

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

There are 2 classes . Class A and Class B. In Class A i declared a variable in private. if we can a..

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

There are 2 classes . Class A and Class B. In Class A i declared a variable in private. if we can a..

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

There are 2 classes . Class A and Class B. In Class A i declared a variable in private. if we can a..

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

Post New Answer

More J2EE Interview Questions

What is client-certificate authentication?

0 Answers  


How does javac compiler work?

0 Answers  


What is application client container?

0 Answers  


what is transaction?what are the differenr type of transactions

1 Answers   HCL,


What is conversational state?

0 Answers  






Is java a web technology?

0 Answers  


Define thin client?

0 Answers  


Describe action form?

0 Answers  


static variable is a class variable which value remains constant for the entire class?? variable means value is changed....hear value is not changed... why it is called static variable

5 Answers   Infosys,


when i m calling java for web browser . so browser it's not support. show error in browser: internal error occur. java.lang.NoClassDefFoundError. will you give me solution why it's not starting browser.? is there any consult with .net framework2.0?

0 Answers  


What are j2ee components?

0 Answers  


What is java listener?

0 Answers  


Categories