Java 8 Challenges

Coding question :
Class 1 ( 3 minutes )
Create class Student
Add 2 properties in this class — String name and List subjects
Create Getters and parameterized constructor to initialize the values of properties.
Class 2 ( 5 minutes)
Create class School
Add one method — List createStudents() which will return list of Student objects
Return below 2 Students in a list from createStudents() –>

name : Rohit ; subjects : English, Science, History
name : Rahul ; subjects : English, Science, Mathematics

User Story 1 ( 10 minutes )
Product Owner wants to know the names of Students who have History as subject. Create a method List findStudentNameWithHistorySubject(List students)

This method should accept List as parameter and find out the names of all students who have History as subject & return in a List.
User Story 2 ( 10 minutes)
Product Owner wants to know what all different subjects are being taught in your school. Create a method List findSubjects(List students)

This method should accept List as parameter and find out different subjects & return in a List. (not Set/HashSet). Subjects should not be duplicated.

原文链接:Java 8 Challenges

© 版权声明
THE END
喜欢就支持一下吧
点赞7 分享
No matter what label is thrown your way, only you can define your self.
不管你被贴上什么标签,只有你才能定义你自己
评论 抢沙发

请登录后发表评论

    暂无评论内容