Home>
It seems that the method is instantiated in the heap area, but the heap area is the recognition of shared memory.
I feel that when Mr. A and Mr. B instantiate the same class and call the same method, the value changes. Is this a mistake?
public int tasizan (int a, int b) {
return a + b;
}
1, A calls method with tasizan (1,2)
↓ (Before Mr. A's return)
2, B calls the method with tasizan (3,4)
Isn't the above movement (a movement in which Mr. A's return value becomes "7") possible?
-
Answer # 1
Related articles
- java regarding the behavior when multiple users call the same method
- java main method not found using eclipse
- how to store multi-line input as multiple array of numbers in java standard input
- java - search multiple items about how to write findby 〇 and △ like()
- java - i don't know the cause of the error "this method must return a result of type ○○○○"
- java - i want to output multiple characters at the same time with the println statement
- i want to create a midi file "with multiple tracks" in java however, the file type doesn't seem to be supported
- java - programming to retrieve multiple records from db
- multiple for loop java
- java - i want to use the return value of one method in another
- method of confirming equivalence of different types in java
- multiple batch replacement method using php str_replace
- java - about the stringvalueof () method
- java - equals method
- java - android i want to register multiple screen buttons at once in setonclicklistener
- java - you can have multiple same android activities multiple layers? ?? ??
- java instance generation method
- java - about flatmap method
- java - how to return multiple responses of servlet
Trends
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- javascript - how to check if an element exists in puppeteer
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- sh - 'apt-get' is not recognized as an internal or external command, operable program or batch file
- i want to call a child component method from a parent in vuejs
- python 3x - typeerror: 'method' object is not subscriptable
In the first place, even if you create an instance, there is no method there.
Both instance methods and class methods are located in the memory area on the class side.
This is because it is not necessary to prepare methods with exactly the same contents in the area of each instance because only the field data is different for each instance.
Then, the arguments such as a and b are placed in the stack area and the method is called.
As you can see from the recursive call behavior, even if you call the same method in the middle of the method, the arguments and local variables of each method are independent, so
It should not be rewritten without permission.