aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Object c = new long[4]; Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Object c = new long[4];" Watch "Object c = new long[4];" New topic
Author

Object c = new long[4];

Glen Iris
Ranch Hand

Joined: Jul 13, 2011
Posts: 164

What is this line of code doing:



Why are the square brackets used "[]" ?


OCPJP 6, OCMJD
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3615
    
  14

You are creating a new array of long, with length 4, and assigning it to an Object variable. Recall that arrays are objects too.

You know about arrays, right?
Glen Iris
Ranch Hand

Joined: Jul 13, 2011
Posts: 164

Thanks Stephan.

I had studied too much yesterday. That line of code made no sense to me. All is clear after a good nights sleep. Thanks again. :-)
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3615
    
  14

We all have moments like that. Happy to help
 
Don't get me started about those stupid light bulbs.
 
subject: Object c = new long[4];