I write some coding i want to get 2 output like
Example (1) of object Employee:
 Id#
 Name :
 Age:
 Sex:
 etc.
Example (2) of object Employee:
 Id#
 Name :
 Age:
 Sex:
 etc.

i just dont want a long code..

import java.io.*;
import java.util.Scanner;
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        int i =0;
        int[] iDNumber = new int[5];
        String name;
        int age;
        String sex;
        


        Scanner scan = new Scanner(System.in);
        Employee employ = new Employee();
        String two;
        System.out.print("Please enter an ID number: ");
        iDNumber[1] = scan.nextInt();
        employ.setIDNumber(iDNumber);



        System.out.print("Please enter the employees name: ");
        name = scan.nextLine();
        name = scan.nextLine();
        employ.setName(name);

        System.out.print("Please enter the employees age: ");
        age = scan.nextInt();
        employ.setAge(age);

        System.out.print("Please enter employees sex: ");
        sex = scan.next();
        employ.setSex(sex);

        System.out.print("Please enter the employees Salary ");
        double salary = scan.nextDouble();
        employ.setSalary(salary);

        System.out.print("Please enter the employees jobtitle ");
        String jobTitle = scan.nextLine();
        jobTitle = scan.nextLine();
        employ.setJobTitle(jobTitle);
        System.out.print("\n\n\n\n\n\n\n\n\n\n\n\n");
        String ONE = employ.employee1();
        two = employ.employee1();
        System.out.println(ONE + "\n" + two);
    }

}

Make two employ objects. Wrap your user-input section in a loop and load each object with the correct data. Then, outside of the loop, you can simply output each object. I don't know what's in your employ class, but you could add a method to output the data, or you could just add accessors to output the data in your main method.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.