dcsimg
What is the meaning of this - Object[] x = {new String[]{"a","b"}};
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Aejaz_Sheriff
Posted On:   Monday, June 9, 2003 01:14 AM

What is the meaning of this - Object[] x = {new String[]{"a","b"}}; I have a function which takes Object[] as a argument. And I have data structure like this - Name = Zoolander Name = Hansel Name = Mugatu I am not interested in the Name part. This has to be converted to - Object[] x = {new String[]{"a","b"}} It works if I hard code the values like this - Object[] x = {new String[]{"Zoolander","Hansel","Mugatu"}; Thanks in advance    More>>

What is the meaning of this -


Object[] x = {new String[]{"a","b"}};


I have a function which takes Object[] as a argument. And I have data structure like this -


Name = Zoolander

Name = Hansel

Name = Mugatu



I am not interested in the Name part. This has to be converted to -
Object[] x = {new String[]{"a","b"}}


It works if I hard code the values like this -


Object[] x = {new String[]{"Zoolander","Hansel","Mugatu"};




Thanks in advance    <<Less

Re: What is the meaning of this - Object[] x = {new String[]{"a","b"}};

Posted By:   David_Bates  
Posted On:   Monday, June 9, 2003 05:43 AM

What actually is your question? The 'meaning' of this? How does it work?


What that line does is create a one-dimensional array of type Object. This array has only a single element. That element is a one-dimensional array of Strings. That array of Strings has two elements. Index 0 contains "a". Index 1 contains "b".


Any help?
About | Sitemap | Contact