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.
public class Book { public String author; public String title; public int pages; //... }
我有课书,创建数组Book[] books=new Book[4]; 如何选择作者,写了最多的书?
Book[] books=new Book[4];
遍历数组,并为每个唯一的作者记录作者在单独数组中出版的书籍总数.......我建议您为作者创建一个新类,其中包含他们的姓名和数量他们出版的书籍,并且每次添加带有他们名字的书籍时都会增加它。