Java: Calling a static method in the main() method

前端 未结 4 1936
夕颜
夕颜 2020-12-11 09:19

I am supposed to do the following:

Write a Java application (Client) program with a static method called generateEmployees( ) that returns a random list

4条回答
  •  生来不讨喜
    2020-12-11 09:48

    Like Ash stated but if you need to process the records, here is no reason to introduce extra variable just do

     public static void main(String[] args)
     {
          for(Employee employee: generateEmployees())
             print(employee); // define static print somewhere too
    
     }
    

提交回复
热议问题