Collection

1.You are organizing a small party, which is only allowed 5 people to attend,but 10 people signed for this party, they are:
Jhon, Jack, Alex, Helan, Cecilia, Mia,So nia, Tomas, Tyler, Chris.
Now you need to choose 5 of them randomly to attend your party.
Try to create a program to make it come true, in the end, output your guests' name one by one.

 

2.generate 20 random integer which are in the range from 1 to 20, save them in an ArrayList. print the whole list

then print the sum of all those elements

 

3.generate 20 random integer which are in the range from 1 to 20, save them in an ArrayList. print the whole list

then remove all those even value from list, and print it again

 

 

4.define two ArrayList object and save some values in both of them

print that if they have identical values (same type,same amout,same order,same values)

posted @ 2024-02-23 22:14  派若多克斯  阅读(33)  评论(0)    收藏  举报