File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Assignment of an Array to a key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Assignment of an Array to a key" Watch "Assignment of an Array to a key" New topic
Author

Assignment of an Array to a key

Padma priya Gururajan
Ranch Hand

Joined: Oct 05, 2006
Posts: 434
Hi,
Please look at the following code:
String[] favoriteMusic = { "Zero7","BT","Frou Frou"};
request.setAttribute("musicList","favoriteMusic");



Is it correct to assign a string array to a key called "musicList".


With regards,
Padma priya N.G.


Padma priya N.G.
Be the change you want to be - Mahatma Gandhi
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

You've got extra double quotations. It should be :


Yes it's ok, because as you know, arrays behave like any objects.


[My Blog]
All roads lead to JavaRanch
Padma priya Gururajan
Ranch Hand

Joined: Oct 05, 2006
Posts: 434
Hi,
Thanks.
Padma priya N.G.
 
GeeCON Prague 2014
 
subject: Assignment of an Array to a key