• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

multidimensional array

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
phani ravinutala
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, for your rply,

suppose If I have second array EmpDET as below.






Excepted output should be like below



 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Marshal
Posts: 80219
424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You appear to be very confused about arrays. Have a look at the Java™ Tutorials for a start.
 
Sheriff
Posts: 22821
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
I claim this furniture in the name of The Ottoman Empire! You can keep this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic