-5

What is the difference from

class Test {
    A a = new A();
}

to

class Test {
   static A a = new A();
}

Does the virtual machine perform differently in the initialization?

Luis Eduardo
  • 47
  • 1
  • 11

1 Answers1

1

In the first class there will be a member variable for each instance of the class Test. In the Second class there will be just one member variable for the whole class Test.

stephan
  • 42
  • 3