+ 4

Is there any difference between data members and instance variables in java ???

15th May 2017, 1:51 PM
Dolu
Dolu - avatar
5 Respostas
+ 2
data members are the variables written within the specific method and can only be used in that method,where as the instance variables or global variables are declared before declaring a method and can be called and used anywhere in the program.
31st May 2017, 6:38 PM
Ujjwal Lenka
Ujjwal Lenka - avatar
+ 3
thanx @ Ujjwal Lenka
1st Jun 2017, 9:17 AM
Dolu
Dolu - avatar
+ 2
eg for instance variable:- class ABC { int a; int b; void function () { } these are declared in class block...not in the method block....... and for data members I am not clear in its definition.
15th May 2017, 4:58 PM
Dolu
Dolu - avatar
+ 2
welcome hope the answer was helpful ☺
1st Jun 2017, 9:18 AM
Ujjwal Lenka
Ujjwal Lenka - avatar
0
Can you provide example?
15th May 2017, 2:47 PM
Bartłomiej Janik
Bartłomiej Janik - avatar