• Post Reply Bookmark Topic Watch Topic
  • New Topic

regarding instance variables and static methods  RSS feed

 
Raj Kumar Bindal
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have got following two questions from sun site but i am not clear about the answers they have given,please help.

1.Instance variables maintain. . .
A. one copy of the variable for each class instance
B. a separate value for the state information for each class instance.
C. A constant state of the variable for each class instance.
D. None of the above.


2. Call static methods

A. with the class identifier.
B. with a new instance of the class.
C. None of the above.
 
Svend Rost
Ranch Hand
Posts: 904
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You have class (i.e. static) members and instance members. The instance
members belong to a specific instance of a class. I.e. two objects can have
different values in their instance variables.

Does this help you?

With respect to question two, try to make a small program and test the
three claims.

Did that help you ?

/Svend Rost, who'll check back later..
 
Dave Jones
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Svend Rost's reply should help you find the answer, I suggest you think about it and present your answer here, just to be sure that you got it right.
 
Raj Kumar Bindal
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. A
2. B

These are my answers,but answers which are given are something else..
can anyone tell me why my answers are wrong.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you tell us first why you think they are right, it will be easier to provide the "missing understanding".
 
Raj Kumar Bindal
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
answers are
1. B
2. A

but i am not clear why??
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
#1 is almost into "trick question" territory. What exactly does "copy" mean? I hate questions like this and strive to avoid such language.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!