Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

when are the braces used {}

 
Natraj Gudla
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am working with a URL and URLCLassLoader , in one of the code blocks i have seen
URL[] urlObj = new URL[] {anotherurlobject};
Now what does this mean,
what is this form of declaration using the '{}' braces..
The Jav docs do not speak of any thing of this sort in the URL class...
Is this used for only URL class or we can use it where ever we use an array of objects..
can anyone help me?..
[ July 28, 2003: Message edited by: Natraj Gudla ]
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Curly braces are used to initialize an array in this instance. The line:

Creates an array of URL with a single element urlObj[0] which is equal to anotherurlobject.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic