I am new to java. I have done python before and concatenating elements of two lists or arrays seemed easy with loop. But how to do the same with java??? For example, I have a multidimensional array: //codes
String [][] nameAry={{"Mr.","Mrs.","Ms."},{"Jones","Patel"}};
//The output I am expecting :
Mr. Jones, Mrs. Jones, Ms, Jones, etc.
// I can do it by handpicking elements from indices, as shown in oracle documentation, but what I am looking for is a loop to do the job instead of doing: //code
System.out.println(nameAry[0][0]+", "+nameAry[1][0]);
` ////So, is there a way to put it the way I do in python,i.e.,:
x=["Mr.","Mrs.","Ms."]
y=["Jonse","patel"]
names-[a+b for a in x for b in y]
///this gives me the following result:
['Mr.Jonse', 'Mr.patel', 'Mrs.Jonse', 'Mrs.patel', 'Ms.Jonse', 'Ms.patel']
//So, is there something like this in Java???