Thread 1 and thread 2 get the a method of class A through reflection at the same time, so which part of the method obtained by thread 1 and thread 2 is in memory? Are thread 1 and thread 2 getting the same method address?
Thread 1 and thread 2 get the a method of class A through reflection at the same time, so which part of the method obtained by thread 1 and thread 2 is in memory? Are thread 1 and thread 2 getting the same method address?
there is only one method in a class in memory, and the Method object we get through reflection is a wrapper of the actual method. The address is different in
heap.
there is only one copy of the metadata of the java class in memory, and only one copy of methods and fields are reflected in Permanent Generation space.