This content has been marked as final. Show 6 replies
user10137999 wrote:Then that isn't a good example to work with. You're going to get all mixed up with the string pool and the question of whether string literals are created by the compiler. The question of objects created as part of the internal implementation of the String and StringBuffer arises as well.
I wanted to know how object is garbage collected.
If this question looks home work for you, practice and tell me.I don't need the practice thanks. It is you who needs the practice, in asking questions that are going to get answers.
Other wise let others give answers.I'm not stopping anyone from giving answers. I couldn't if I wanted to. I'm just telling you what you're going to get on this forum, from long experience. The concensus here has always been that is pointless for anybody to just give you the answer. The point of the homework is the thought process, and it has to be started by you. You have to learn it for yourself. You can't just keep asking on forums for the rest of your working life. I learnt IT many years before there were any forums at all, so it is quite possible.
I agree with DrClap that this is a particularly poor example for teaching garbage collection. An example not involving Strings would be much more illuminating.
The other reason for not answering your question directly is that it has already been asked here and elsewhere thousands of times. (For some reason teachers seem to think it a good question. One wonders whether some of them know the correct answer themselves; not that I care because it isn't a particularly useful answer to know.) You don't show any sign of having even looked for a prior answer. In short you have done zero work yourself, and until that changes you are most unlikely to get an answer here.
EJP wrote:Ah the good old days where people actually made an effort and were happy to do so. A dying breed.
I learnt IT many years before there were any forums at all, so it is quite possible.
I don't understand these legions of people that seemed to have gotten it into their brain that it is actually remotely possible to learn this stuff in forums. Where are these misguided saps coming from? Even in the universe of Dragon Ball Z the dudes have to hit the books to learn stuff, it ain't the television that is teaching this madness.
We used to fight over the manuals as there weren't enough to go round ... Now that there are manuals and specifications and tutorials all over the Web nobody will read them.
On the other hand I was the only guy in town with a copy of Knuth, nobody else had the wit to buy one, although they could see it on my desk, and they all wondered how I knew all the standard algorithms. I guess that corresponds with the apparent fact that the better the Internet source the less likely it is to be read.