• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

when are the braces used {}

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic