Java exercise: basic data structure Exercise

1. Define a method listtest (ArrayList, list, string name) to return the index of the first occurrence of name in the list. If name does not appear, return - 1.

2. The known array stores a batch of QQ numbers with a length of 5-11 bits. String [] STRs = {"10001", "10086", "12347806666", "45612378901", "10001", "12347806666"}. Store all QQ numbers in the array in the LinkedList, delete duplicate elements in the list, and print all elements in the list with iterators and enhanced for loops respectively.

3. Please randomly generate a two-color ball number. (the same color number shall not be repeated). Two color ball rule: each betting number of two-color ball consists of 6 red ball numbers and 1 blue ball number. The red ball number is selected from 1-33; The blue ball number is selected from 1-16;

4. Use the two interfaces of comparable and comparator to sort the scores of the following four students in descending order. If the scores are the same, sort them according to their age on the basis of score ranking.

The code is as follows:

one

two

three

four

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>