This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Sequence Of events by JVM Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Sequence Of events by JVM" Watch "Sequence Of events by JVM" New topic
Author

Sequence Of events by JVM

Sahil Kapoor
Ranch Hand

Joined: Sep 12, 2009
Posts: 316
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 ???

SCJP 6.0 96%

(Connecting the Dots ....)
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 20078
    
  30

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
 
Have you checked out Aspose?
 
subject: Sequence Of events by JVM
 
It's not a secret anymore!