dcsimg
Meaning of this - Object[] x = {new String[]{"a","b"};
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Aejaz_Sheriff
Posted On:   Monday, June 9, 2003 01:07 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: Meaning of this - Object[] x = {new String[]{"a","b"};

Posted By:   Andrew_York  
Posted On:   Thursday, June 19, 2003 12:42 PM

This should create an array of type Object with one element that is an array of strings.


X[0] = a String[]



String[0] = a

String[1] = b

Re: Meaning of this - Object[] x = {new String[]{"a","b"};

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

A small typo correction to the above. Missed the closing braces -


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

About | Sitemap | Contact