jQuery in Action, 3rd edition
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
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: 3989
    
  18

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?


The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
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: 3989
    
  18

We all have moments like that. Happy to help
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Object c = new long[4];
 
It's not a secret anymore!