This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes multidimensional array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "multidimensional array" Watch "multidimensional array" New topic
Author

multidimensional array

phani ravinutala
Greenhorn

Joined: Jun 25, 2009
Posts: 26
I have two string arrays like below.



Here is my code:

But I'm getting the below output:





Expected output should be like below



Could please anyone help me?
thanks

Rajeev Ravindran
Ranch Hand

Joined: Aug 27, 2002
Posts: 455
i dont really understand your question but i did a quick test and this is what i got !! you don't need to keep Emp as inner class as i have defined.



SCJP, SCWCD, SCBCD, Oracle Certified Professional (SQL n PL/SQL)
phani ravinutala
Greenhorn

Joined: Jun 25, 2009
Posts: 26
Thanks, for your rply,

suppose If I have second array EmpDET as below.






Excepted output should be like below



Rajeev Ravindran
Ranch Hand

Joined: Aug 27, 2002
Posts: 455
LOL are you gonna pay me for doing your job ? try it yourself and if you get into issues, someone will help you. Hope i don't sound rude !!

Thanks,
phani ravinutala
Greenhorn

Joined: Jun 25, 2009
Posts: 26
thanks for your help.

I'm new this programming.


Can anyone please help me?

how would I set the object Employee?

what is the best way?




thanks
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37950
    
  22
You appear to be very confused about arrays. Have a look at the Java™ Tutorials for a start.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

phani ravinutala wrote:

Do you realize that you are using the very same Emp instance and just update that one? In the end, your list will contain several references to that very same instance, which will contain the values of the last array elements. Move the "Emp emp = new Emp();" line into the loop, just before you set the name.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
Consider Paul's rocket mass heater.
 
subject: multidimensional array
 
Similar Threads
summing each row in a 2-dimensional array
Index out of Bound
Cannot create iterator for FormBean
Is there any free libraries avaialble for file splitting usiong java??
Sorting arrays while retaining original index