Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
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


Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
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: 19947
    
  23

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sequence Of events by JVM