Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Sequence Of events by JVM  RSS feed

 
Sahil Kapoor
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the sequence of Events taken by JVM for the follwing line of Code ??

int[] a= new int[6];

OPTION 1

1) Refernce Variable a is created first and is initializes to NULL.
2) An array object is created.
3) Information abt how to access that object is then put into the refernce variable.

Option 2

1)) An array object is created.
2) Refernce Variable a is created first and is initializes to NULL.
3) Information abt how to access that object is then put into the refernce variable.


Please explain also ???
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The results from "java -p Test":
I'm no expert in reading this, but to me, it looks like the array is created first, then the variable is created.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!