4

i want to know that , is finish(); call effect static variables.? does static variables is affected by GC.

static int displayChart = 0;

code of declaration.

Youddh
  • 1,511
  • 4
  • 34
  • 51
  • Try to avoid `static`. There is almost always a better way without. http://stackoverflow.com/questions/7026507/why-are-static-variables-considered-evil – zapl Sep 01 '12 at 14:45
  • Correction: avoid static stateful variables aka globals – Patrick Jun 26 '13 at 22:06

2 Answers2

12

static variable belongs to class not the object, and finish() or garbage collector affects object, therefore it got no influence on static variables. Please note that class does not equals object but object is instance of class.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
6

No there is no effect on static variable by calling finish or gc. You can access those variable from other activity for the proof

Altaf
  • 5,150
  • 10
  • 39
  • 55