Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个名为 employee() 的对象列表,我使用 emp 作为我的对象。我想增加员工并打印所有对象的名称。我真的迷失了如何做到这一点。谢谢。
for( emp ; ;employees()) { System.out.println(emp.name); }
尝试使用foreach()
foreach()
for(Employee employee : employees()) { System.out.println(employee.name); }