Infosys
Company
Programming
Technical
Statement A: Variables defined with static keyword are called class variable.
Statement B: A static variable is available from any instance of a class.
Select the correct option for the preceding statements:
A. Statement A is true while Statement B is false.
B. Statement A is false while Statement B is true.
C. Both Statement A and Statement B are false.
D. Both Statement A and Statement B are true.
Read Solution (Total 8)
-
- Ans: D
Both Statement A and B are true - 10 years agoHelpfull: Yes(9) No(2)
- A:
static variables are created only when the class is loaded,so they are also called as class Variables..
Static variables are not available in Instance class..
- 10 years agoHelpfull: Yes(9) No(0)
- c.
bcoz static var never need instance of class
and var having static keyword is called static variable...
- 10 years agoHelpfull: Yes(5) No(2)
- I think D option is correct because when u create an instance(object) of a class u can can access any properties of the class i.e either static or non-static. So with instance we can access static variables also. Static variables are also called class variables.
Hope this is useful.
- 9 years agoHelpfull: Yes(2) No(0)
- ans: B
variable define with static keyword is called static variable not class variable.
second statement is right - 10 years agoHelpfull: Yes(0) No(2)
- A
EXPLA NATION: STATIC IS A ONE OF THE STORSGE CLSSS SCOPE IS THE THHIS FILE ONLY - 10 years agoHelpfull: Yes(0) No(0)
- A :
b'coz static variable doesno't need any instances - 6 years agoHelpfull: Yes(0) No(0)
- A variable is declared with static variable but it is not called as class variable.
Static variable can be accessed without an instance of class - 6 years agoHelpfull: Yes(0) No(0)
Infosys Other Question