Java 通过引用未使用for循环显示的其他方法的对象显示数组值

Java 通过引用未使用for循环显示的其他方法的对象显示数组值,java,arrays,for-loop,polymorphism,parameter-passing,Java,Arrays,For Loop,Polymorphism,Parameter Passing,基本上,我的程序的要点是一个工资单程序,用户可以输入员工数量,然后使用相同数量的员工完成指示员工类型的过程,然后根据类型继续输入员工信息。现在,我要一次一个,首先从每小时一次开始。我成功地获得了我想要的输出,直到我完成while循环的条件并输出结果表,但它不输出结果,只输出列标签。我决定使用for循环,以便它继续显示,直到它达到一个大于大小的数字。我检查了数组[e]的格式是否正确;但到目前为止,似乎还没有发现任何错误 是否可能是参数不匹配或可能被滥用 提前谢谢 Scanner in = ne

基本上,我的程序的要点是一个工资单程序,用户可以输入员工数量,然后使用相同数量的员工完成指示员工类型的过程,然后根据类型继续输入员工信息。现在,我要一次一个,首先从每小时一次开始。我成功地获得了我想要的输出,直到我完成while循环的条件并输出结果表,但它不输出结果,只输出列标签。我决定使用for循环,以便它继续显示,直到它达到一个大于大小的数字。我检查了数组[e]的格式是否正确;但到目前为止,似乎还没有发现任何错误

是否可能是参数不匹配或可能被滥用

提前谢谢

  Scanner in = new Scanner(System.in);
  System.out.println("Welcome to the Company's Payroll System!");
  System.out.println("Please enter the amount of employees in the company.");
  int size = in.nextInt();
  Employee [] staff = new Employee [size];

  int i = 0;

  while (i != staff.length ) 
      {

      System.out.println("Enter employee type (Choose Hourly, Salary, or Manager)");
      System.out.println("Press 4 to exit.");
      String emptype = in.next();

     if (emptype.equalsIgnoreCase("Hourly")) 
     {
        System.out.println("First name:"); 
        String first = in.next();

        System.out.println("Last name:");
        String last = in.next();

        System.out.println("Employee ID (7 digits):");
        Float identification = in.nextFloat();

        System.out.println("Job Title:");
        String title = in.next();

        System.out.println("Amount employee makes per hour: ");
        double hour = in.nextDouble();

        staff [i] = new HourlyEmployee(first, last, identification, title, hour);

        i++;
     }

      }


       System.out.println("FIRST NAME \t LAST NAME \t ID \t JOB TITLE \t Weekly Salary");
       for (int e = 0; e > size; e++)
       {
       System.out.printf("%5d", staff[e].getfirstName() + staff[e].getlastName() + staff[e].getId() + staff[e].getTitle() + staff[e].weeklyPay() );}
      }

}在循环中,您的条件是错误的。应该是:

for (int e=0; e < size; e++)