Monday, 14 January 2019

java - What happens when you create a new object?

Ok, so what happens when you do this.




A a1=new A();

A a2=new A();

A a3=new A();


I upload two pictures on how I imagine it being like. Can you tell me what picture is true?



First picture:

enter image description here



Second picture:
enter image description here



I always thought the first picture is true, but now I don't really know, and I suspect the second to be true.



Also, can you explain to me what each side does?
Like, what does "A a1" do and what does "new A()" do?




Thanks.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...