I'm curious about the JAVA memory address!

Asked 2 years ago, Updated 2 years ago, 26 views

Class Test{

FavoritesAdapter favoritesAdapter = new FavoritesAdapter(); --- 1

FavoritesAdapter favoritesAdapter = new FavoritesAdapter(); --- 2

}

Like this, the Favorites Adapter type name is the same Assigning a new operator consecutively

Even if the type name is the same, the new operator is used twice in a row

Can I get two in the hip area?

Or is it just one??

java android

2022-09-22 17:54

1 Answers

Two are created separately in the heap region.

Like this, Favorites Adapter object names are the same...

It's more accurate to call it a type name or a class name than an object name.

Then I'll go now


2022-09-22 17:54

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.