Wednesday 15 January 2014

java - Why Visual VM shows instances as zero for this String class? -



java - Why Visual VM shows instances as zero for this String class? -

this sample programme creates string object

public class testingheap { public static void main(string args[]) { string str = new string("hi sample string"); seek { //thread.sleep(1111111); } grab (interruptedexception e) { // todo auto-generated grab block e.printstacktrace(); } } }

when viewed heap dump under visualvm tool instances class shown 0

this screenshot wrt above statement

if assumption wrong please allow me know how see objects nowadays under heap ??

because main() method static , code doesn't create instance of testingheap. so,

testingheap th = new testingheap(); // <-- add together main.

java

No comments:

Post a Comment