Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3675564
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:59:30+00:00 2026-05-19T02:59:30+00:00

Actually i had been practicing some of the java programs today(trying to learn it

  • 0

Actually i had been practicing some of the java programs today(trying to learn it myself). I am trying to write a program which accepts as many employee details from the user and displaying it. I wrote the code for the same, but failed. There where no compile errors. I tried to create an ArrayList to place the details got from the user. But not very sure how that be done. Or should that be done by using an object array?

Can anyone help me? Also please do suggest any ways by which i can improve my coding. I’ll be really thankful.

Below given is my code :

public class EmployeeList{

    String empname;
    String empaddress;
    int empage;

    public void getEmployeeDetails(){
        try{
            final BufferedReader br =
                new BufferedReader(new InputStreamReader(System.in));
            System.out.println("Name :");
            empname = br.readLine();
            System.out.println("Address :");
            empaddress = br.readLine();
            System.out.println("Age :");
            empage = Integer.parseInt(br.readLine());
        }

        catch(final IOException e){

            e.printStackTrace();
        }
    }

    public void displayEmployeeDetails(){
        System.out.println("Name :" + empname);
        System.out.println("Address :" + empaddress);
        System.out.println("Age : " + empage);
    }
}

SerialisePersonList.java

public class SerialisePersonList{

    public static void main(final String[] args){
        final EmployeeList emp = new EmployeeList();
        System.out.println("Enter 3 person details");
        for(int i = 1; i <= 3; i++){
            System.out.println("Enter details of person" + i);
            final List details = new ArrayList();
            details.add(emp.getEmployeeDetails());
        }

        System.out.println("The entered person Details are as following");
        for(int i = 1; i <= 3; i++){
            System.out.println("Details of person" + i);
            emp.displayEmployeeDetails();
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T02:59:31+00:00Added an answer on May 19, 2026 at 2:59 am

    You need to create arraylist before cycle scope and add particular empoloyee in cycle

    public static void main(String[] args) 
            {
               List<EmployeeList> details = new ArrayList<EmployeeList>();  
               System.out.println("Enter 3 person details");
               for(int i=1;i<=3;i++)
               {
                   System.out.println("Enter details of person"+i);
                   EmployeeList emp =new EmployeeList();
                   emp.getEmployeeDetails();
                   details.add(emp);
               }
    
               System.out.println("The entered person Details are as following");
               for(EmployeeList employee : details)
               {
                   System.out.println("Details of person");
                   employee.displayEmployeeDetails();
               }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to start modifying an existing application with Eclipse. Actually I had it
Here is a question that I have had for some time but never actually
Until today, my understanding of .NET Tuple classes had been that they delegate their
I've never actually had an instance where this was required, but here I am...
This is actually related to another question I had that was already answered. That
I had a quick question. Is it possible to save a file without actually
I've always had a weird feeling in my gut about actually deleting rows from
I have several large word lists and I had been loading them in place
Google has indexed this page http://[site-removed]/showering-accessories on my client's site which doesn't actually exist.
I have been working on this site for some time and just launched it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.