MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.util.HashSet;
import java.util.Set;

public class MainClass {
    public static void main(String args[]) {
        String[] name1 = { "Amy", "Jose", "Jeremy", "Alice", "Patrick" };

        String[] name2 = { "Alan", "Amy", "Jeremy", "Helen", "Alexi" };

        String[] name3 = { "Adel", "Aaron", "Amy", "James", "Alice" };

        Set<String> letter = new HashSet<String>();

        for (int i = 0; i < name1.length; i++)
            letter.add(name1[i]);

        for (int j = 0; j < name2.length; j++)
            letter.add(name2[j]);

        for (int k = 0; k < name3.length; k++)
            letter.add(name3[k]);

        System.out.println(letter.size() + " letters must be sent to: " + letter);

    }
}