This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Object c = new long[4];

 
Glen Iris
Ranch Hand
Posts: 172
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is this line of code doing:



Why are the square brackets used "[]" ?
 
Stephan van Hulst
Bartender
Pie
Posts: 5898
63
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 172
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 5898
63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We all have moments like that. Happy to help
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic