admin管理员组

文章数量:1584462

第七章第十五题(消除重复)(Eliminate duplication)

  • 7.15(消除重复)使用下面的方法头编写方法,消除数组中重复出现的值
    public static int[] eliminateDuplication(int[] list)
    编写一个测试程序,读取10个整数,调用该方法,并显示以一个空格分隔的不同数字。下面是程序的运行实例:
    Enter ten numbers:
    1 2 3 2 1 6 3 4 5 2
    The distinct numbers are:1 2 3 6 4 5
    7.15(Eliminate duplication)Write a method using the method header below to eliminate duplicate values in the array
    public static int[] eliminateDuplication(int[] list)
    Write a test program, read 10 integers, call this method, and display different numbers separated by a space. The following is a running example of the program:
    Enter ten numbers:
    1 2 3 2 1 6 3 4 5 2
    The distinct numbers are:1 2 3 6 4 5

  • 参考代码:

    package chapter07;
    
    import java.util.Scanner;
    
    public class Code_15 {
         
        public static void main(String[] args) {
         
            System.out.println("Enter ten numbers:");
            Scanner input=new 

本文标签: 第七章Eliminateduplication