Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.List;
- import java.util.ArrayList;
- public class Conditional {
- public static void main(String[] args) {
- Person[] person = new Person[5];
- ArrayList<Person> suspects = new ArrayList<>();
- for (int i = 0; i<person.length; i++)
- {
- if (person[i].hair == HairColor.BLACK &&
- person[i].height >= 65 && person[i].height <= 68 &&
- person[i].race == Race.INDIAN &&
- person[i].age >= 20 && person[i].age <= 24)
- {
- suspects.add(person[i]);
- }
- }
- }
- }
- class Person {
- HairColor hair;
- int height;
- Race race;
- int age;
- }
- enum HairColor {
- BLACK,
- BROWN,
- BLONDE
- }
- enum Race {
- BLACK,
- PURPLE,
- GREEN,
- INDIAN
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement