sudheer kiran wrote:1)can we get a list of objects that are presently in memory by passing full class name?
2)can we list classes that are loaded into memory.
As far as I know: no - except maybe on a case by case basis - however, you might be able to get some of that information from a profiler.
My question is: Why do you think you need to know this? Java is not C/C++, so memory management is not your concern. And you absolutely should not write programs that rely on that information, or any pattern derived from it, as the memory model may change in the future. I've never needed anything like it in 10 years of using Java.
Isn't it funny how there's always time and money enough to do it WRONG?
Artlicles by Winston can be found here
If you really want to do this, then it might be possible by using the JVM's debugger API, but that means you're actually writing a debugger for Java programs, which is not a very easy task. There are not some easy to use methods you can call to list all instances of a particular class in the current JVM.