This week's book giveaway is in the Java in General forum. We're giving away four copies of Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework and have Michael Redlich on-line! See this thread for details.
Hi all.
I want to know that if i use String[] a = new String[100], will it take any memory? If yes please tell me that how can i free it up. I also want to know that will it effect the performance if i use many times String[].
In my opinion, it will allocate an array object containing 100 null items.
to free it, you just have to do a = null; to dereference the array from its variable, and the garbage collector will do its job -> cleaning all unreferenced objects.
I'm not a "java memory" expert, but I think it works like this.